Merge tag 'xfs-6.9-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-block.git] / fs / xfs / xfs_attr_item.c
index 9e02111bd89010ab572c4e6d41ca71465d98f142..9b4c61e1c22e8ddfb1e4942e8e6282b6c4557d9f 100644 (file)
@@ -108,7 +108,7 @@ STATIC void
 xfs_attri_item_free(
        struct xfs_attri_log_item       *attrip)
 {
-       kmem_free(attrip->attri_item.li_lv_shadow);
+       kvfree(attrip->attri_item.li_lv_shadow);
        xfs_attri_log_nameval_put(attrip->attri_nameval);
        kmem_cache_free(xfs_attri_cache, attrip);
 }
@@ -226,7 +226,7 @@ xfs_attri_init(
 {
        struct xfs_attri_log_item       *attrip;
 
-       attrip = kmem_cache_zalloc(xfs_attri_cache, GFP_NOFS | __GFP_NOFAIL);
+       attrip = kmem_cache_zalloc(xfs_attri_cache, GFP_KERNEL | __GFP_NOFAIL);
 
        /*
         * Grab an extra reference to the name/value buffer for this log item.
@@ -251,7 +251,7 @@ static inline struct xfs_attrd_log_item *ATTRD_ITEM(struct xfs_log_item *lip)
 STATIC void
 xfs_attrd_item_free(struct xfs_attrd_log_item *attrdp)
 {
-       kmem_free(attrdp->attrd_item.li_lv_shadow);
+       kvfree(attrdp->attrd_item.li_lv_shadow);
        kmem_cache_free(xfs_attrd_cache, attrdp);
 }
 
@@ -386,11 +386,16 @@ xfs_attr_free_item(
                xfs_da_state_free(attr->xattri_da_state);
        xfs_attri_log_nameval_put(attr->xattri_nameval);
        if (attr->xattri_da_args->op_flags & XFS_DA_OP_RECOVERY)
-               kmem_free(attr);
+               kfree(attr);
        else
                kmem_cache_free(xfs_attr_intent_cache, attr);
 }
 
+static inline struct xfs_attr_intent *attri_entry(const struct list_head *e)
+{
+       return list_entry(e, struct xfs_attr_intent, xattri_list);
+}
+
 /* Process an attr. */
 STATIC int
 xfs_attr_finish_item(
@@ -399,11 +404,10 @@ xfs_attr_finish_item(
        struct list_head                *item,
        struct xfs_btree_cur            **state)
 {
-       struct xfs_attr_intent          *attr;
+       struct xfs_attr_intent          *attr = attri_entry(item);
        struct xfs_da_args              *args;
        int                             error;
 
-       attr = container_of(item, struct xfs_attr_intent, xattri_list);
        args = attr->xattri_da_args;
 
        /* Reset trans after EAGAIN cycle since the transaction is new */
@@ -443,9 +447,8 @@ STATIC void
 xfs_attr_cancel_item(
        struct list_head                *item)
 {
-       struct xfs_attr_intent          *attr;
+       struct xfs_attr_intent          *attr = attri_entry(item);
 
-       attr = container_of(item, struct xfs_attr_intent, xattri_list);
        xfs_attr_free_item(attr);
 }
 
@@ -512,8 +515,8 @@ xfs_attri_recover_work(
        if (error)
                return ERR_PTR(error);
 
-       attr = kmem_zalloc(sizeof(struct xfs_attr_intent) +
-                          sizeof(struct xfs_da_args), KM_NOFS);
+       attr = kzalloc(sizeof(struct xfs_attr_intent) +
+                       sizeof(struct xfs_da_args), GFP_KERNEL | __GFP_NOFAIL);
        args = (struct xfs_da_args *)(attr + 1);
 
        attr->xattri_da_args = args;
@@ -666,7 +669,7 @@ xfs_attr_create_done(
 
        attrip = ATTRI_ITEM(intent);
 
-       attrdp = kmem_cache_zalloc(xfs_attrd_cache, GFP_NOFS | __GFP_NOFAIL);
+       attrdp = kmem_cache_zalloc(xfs_attrd_cache, GFP_KERNEL | __GFP_NOFAIL);
 
        xfs_log_item_init(tp->t_mountp, &attrdp->attrd_item, XFS_LI_ATTRD,
                          &xfs_attrd_item_ops);