Skip to content

Commit c75f1a2

Browse files
author
Darrick J. Wong
committed
xfs: add a xattr_entry helper
Add a helper to translate from the item list head to the attr_intent item structure and use it so shorten assignments and avoid the need for extra local variables. Inspired-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 8028411 commit c75f1a2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/xfs/xfs_attr_item.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ xfs_attr_free_item(
391391
kmem_cache_free(xfs_attr_intent_cache, attr);
392392
}
393393

394+
static inline struct xfs_attr_intent *attri_entry(const struct list_head *e)
395+
{
396+
return list_entry(e, struct xfs_attr_intent, xattri_list);
397+
}
398+
394399
/* Process an attr. */
395400
STATIC int
396401
xfs_attr_finish_item(
@@ -399,11 +404,10 @@ xfs_attr_finish_item(
399404
struct list_head *item,
400405
struct xfs_btree_cur **state)
401406
{
402-
struct xfs_attr_intent *attr;
407+
struct xfs_attr_intent *attr = attri_entry(item);
403408
struct xfs_da_args *args;
404409
int error;
405410

406-
attr = container_of(item, struct xfs_attr_intent, xattri_list);
407411
args = attr->xattri_da_args;
408412

409413
/* Reset trans after EAGAIN cycle since the transaction is new */
@@ -443,9 +447,8 @@ STATIC void
443447
xfs_attr_cancel_item(
444448
struct list_head *item)
445449
{
446-
struct xfs_attr_intent *attr;
450+
struct xfs_attr_intent *attr = attri_entry(item);
447451

448-
attr = container_of(item, struct xfs_attr_intent, xattri_list);
449452
xfs_attr_free_item(attr);
450453
}
451454

0 commit comments

Comments
 (0)