]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
fs: xfs: Remove KM_NOSLEEP and KM_SLEEP.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fri, 13 Dec 2019 00:54:33 +0000 (19:54 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 13 Dec 2019 00:54:33 +0000 (19:54 -0500)
Source kernel commit: 707e0ddaf67e8942448ebdd16b523e409ebe40ce

Since no caller is using KM_NOSLEEP and no callee branches on KM_SLEEP,
we can remove KM_NOSLEEP and replace KM_SLEEP with 0.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
15 files changed:
include/kmem.h
libxfs/logitem.c
libxfs/trans.c
libxfs/xfs_alloc.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_bmap.c
libxfs/xfs_da_btree.c
libxfs/xfs_defer.c
libxfs/xfs_dir2.c
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_sf.c
libxfs/xfs_inode_fork.c
libxfs/xfs_refcount.c
libxfs/xfs_rmap.c
libxlog/xfs_log_recover.c

index 03475c6586a0ee729465cbe3ef343a54d9d9c804..89475ffcb4dc7a4b70413fb8eb76855ba2487150 100644 (file)
@@ -6,8 +6,6 @@
 #ifndef __KMEM_H__
 #define __KMEM_H__
 
-#define KM_SLEEP       0x0001u
-#define KM_NOSLEEP     0x0002u
 #define KM_NOFS                0x0004u
 #define KM_MAYFAIL     0x0008u
 #define KM_LARGE       0x0010u
index 14c62f670bb8c971355e827e556b426438850fa4..b11df4fae6ee4faaee2883bd5e8824e6de50b3e5 100644 (file)
@@ -97,8 +97,7 @@ xfs_buf_item_init(
                }
        }
 
-       bip = (xfs_buf_log_item_t *)kmem_zone_zalloc(xfs_buf_item_zone,
-                                                   KM_SLEEP);
+       bip = (xfs_buf_log_item_t *)kmem_zone_zalloc(xfs_buf_item_zone, 0);
 #ifdef LI_DEBUG
        fprintf(stderr, "adding buf item %p for not-logged buffer %p\n",
                bip, bp);
@@ -140,8 +139,7 @@ xfs_inode_item_init(
        xfs_inode_log_item_t    *iip;
 
        ASSERT(ip->i_itemp == NULL);
-       iip = ip->i_itemp = (xfs_inode_log_item_t *)
-                       kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP);
+       iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, 0);
 #ifdef LI_DEBUG
        fprintf(stderr, "inode_item_init for inode %llu, iip=%p\n",
                ip->i_ino, iip);
index cda2450fc3bb76b796d8fda37a9745c8f9387877..42c2e9e19e5a7bbfb917b32dc53f15f371635552 100644 (file)
@@ -141,7 +141,7 @@ xfs_trans_dup(
 {
        struct xfs_trans        *ntp;
 
-       ntp = kmem_zone_zalloc(xfs_trans_zone, KM_SLEEP);
+       ntp = kmem_zone_zalloc(xfs_trans_zone, 0);
 
        /*
         * Initialize the new transaction structure.
@@ -258,7 +258,7 @@ libxfs_trans_alloc(
        struct xfs_trans        *tp;
        int                     error;
 
-       tp = kmem_zone_zalloc(xfs_trans_zone, KM_SLEEP);
+       tp = kmem_zone_zalloc(xfs_trans_zone, 0);
        tp->t_mountp = mp;
        INIT_LIST_HEAD(&tp->t_items);
        INIT_LIST_HEAD(&tp->t_dfops);
index f5200ae88d5c1436a9076cd61ed3c71d5f780ee1..76af2f2fb332c9875f5f40310237129e53076da2 100644 (file)
@@ -2200,7 +2200,7 @@ xfs_defer_agfl_block(
        ASSERT(xfs_bmap_free_item_zone != NULL);
        ASSERT(oinfo != NULL);
 
-       new = kmem_zone_alloc(xfs_bmap_free_item_zone, KM_SLEEP);
+       new = kmem_zone_alloc(xfs_bmap_free_item_zone, 0);
        new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
        new->xefi_blockcount = 1;
        new->xefi_oinfo = *oinfo;
index b865119cc17722d4f0acc0e76382c7fa6ccb9d44..65100130d78f759006e26594c1411e59e21f0db3 100644 (file)
@@ -778,7 +778,7 @@ xfs_attr_shortform_to_leaf(
        ifp = dp->i_afp;
        sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
        size = be16_to_cpu(sf->hdr.totsize);
-       tmpbuffer = kmem_alloc(size, KM_SLEEP);
+       tmpbuffer = kmem_alloc(size, 0);
        ASSERT(tmpbuffer != NULL);
        memcpy(tmpbuffer, ifp->if_u1.if_data, size);
        sf = (xfs_attr_shortform_t *)tmpbuffer;
@@ -981,7 +981,7 @@ xfs_attr3_leaf_to_shortform(
 
        trace_xfs_attr_leaf_to_sf(args);
 
-       tmpbuffer = kmem_alloc(args->geo->blksize, KM_SLEEP);
+       tmpbuffer = kmem_alloc(args->geo->blksize, 0);
        if (!tmpbuffer)
                return -ENOMEM;
 
@@ -1444,7 +1444,7 @@ xfs_attr3_leaf_compact(
 
        trace_xfs_attr_leaf_compact(args);
 
-       tmpbuffer = kmem_alloc(args->geo->blksize, KM_SLEEP);
+       tmpbuffer = kmem_alloc(args->geo->blksize, 0);
        memcpy(tmpbuffer, bp->b_addr, args->geo->blksize);
        memset(bp->b_addr, 0, args->geo->blksize);
        leaf_src = (xfs_attr_leafblock_t *)tmpbuffer;
@@ -2163,7 +2163,7 @@ xfs_attr3_leaf_unbalance(
                struct xfs_attr_leafblock *tmp_leaf;
                struct xfs_attr3_icleaf_hdr tmphdr;
 
-               tmp_leaf = kmem_zalloc(state->args->geo->blksize, KM_SLEEP);
+               tmp_leaf = kmem_zalloc(state->args->geo->blksize, 0);
 
                /*
                 * Copy the header into the temp leaf so that all the stuff
index 545cce11f18f63e4ebb6f30e76619a6ba6d4a30b..f55e9919121cc9206d8f99a0c767a3a60a2da7e1 100644 (file)
@@ -546,7 +546,7 @@ __xfs_bmap_add_free(
 #endif
        ASSERT(xfs_bmap_free_item_zone != NULL);
 
-       new = kmem_zone_alloc(xfs_bmap_free_item_zone, KM_SLEEP);
+       new = kmem_zone_alloc(xfs_bmap_free_item_zone, 0);
        new->xefi_startblock = bno;
        new->xefi_blockcount = (xfs_extlen_t)len;
        if (oinfo)
@@ -1092,7 +1092,7 @@ xfs_bmap_add_attrfork(
        if (error)
                goto trans_cancel;
        ASSERT(ip->i_afp == NULL);
-       ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP);
+       ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, 0);
        ip->i_afp->if_flags = XFS_IFEXTENTS;
        logflags = 0;
        switch (ip->i_d.di_format) {
@@ -6087,7 +6087,7 @@ __xfs_bmap_add(
                        bmap->br_blockcount,
                        bmap->br_state);
 
-       bi = kmem_alloc(sizeof(struct xfs_bmap_intent), KM_SLEEP | KM_NOFS);
+       bi = kmem_alloc(sizeof(struct xfs_bmap_intent), KM_NOFS);
        INIT_LIST_HEAD(&bi->bi_list);
        bi->bi_type = type;
        bi->bi_owner = ip;
index 34e4ed737d792e3533b2e5eb6c6293d3c6b3043b..e7af4464c86ea5aacf9045903f5cf45889936af9 100644 (file)
@@ -2095,7 +2095,7 @@ xfs_da_grow_inode_int(
                 * If we didn't get it and the block might work if fragmented,
                 * try without the CONTIG flag.  Loop until we get it all.
                 */
-               mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP);
+               mapp = kmem_alloc(sizeof(*mapp) * count, 0);
                for (b = *bno, mapi = 0; b < *bno + count; ) {
                        nmap = min(XFS_BMAP_MAX_NMAP, count);
                        c = (int)(*bno + count - b);
@@ -2477,7 +2477,7 @@ xfs_buf_map_from_irec(
 
        if (nirecs > 1) {
                map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map),
-                                 KM_SLEEP | KM_NOFS);
+                                 KM_NOFS);
                if (!map)
                        return -ENOMEM;
                *mapp = map;
@@ -2536,7 +2536,7 @@ xfs_dabuf_map(
                 */
                if (nfsb != 1)
                        irecs = kmem_zalloc(sizeof(irec) * nfsb,
-                                           KM_SLEEP | KM_NOFS);
+                                           KM_NOFS);
 
                nirecs = nfsb;
                error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, irecs,
index 0e6d94d8df91bdd2162d39611089665a83227b02..cff27a9b541daeea95718f3b08ba12ccb2e96af4 100644 (file)
@@ -511,7 +511,7 @@ xfs_defer_add(
        }
        if (!dfp) {
                dfp = kmem_alloc(sizeof(struct xfs_defer_pending),
-                               KM_SLEEP | KM_NOFS);
+                               KM_NOFS);
                dfp->dfp_type = type;
                dfp->dfp_intent = NULL;
                dfp->dfp_done = NULL;
index 0df5dd25666a8e09be47fd2b6b14cc7e48ff47e8..b3fbc4d594bd4fea0773feb253ba2217b407fad2 100644 (file)
@@ -108,9 +108,9 @@ xfs_da_mount(
 
        nodehdr_size = mp->m_dir_inode_ops->node_hdr_size;
        mp->m_dir_geo = kmem_zalloc(sizeof(struct xfs_da_geometry),
-                                   KM_SLEEP | KM_MAYFAIL);
+                                   KM_MAYFAIL);
        mp->m_attr_geo = kmem_zalloc(sizeof(struct xfs_da_geometry),
-                                    KM_SLEEP | KM_MAYFAIL);
+                                    KM_MAYFAIL);
        if (!mp->m_dir_geo || !mp->m_attr_geo) {
                kmem_free(mp->m_dir_geo);
                kmem_free(mp->m_attr_geo);
@@ -215,7 +215,7 @@ xfs_dir_init(
        if (error)
                return error;
 
-       args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
+       args = kmem_zalloc(sizeof(*args), KM_NOFS);
        if (!args)
                return -ENOMEM;
 
@@ -252,7 +252,7 @@ xfs_dir_createname(
                XFS_STATS_INC(dp->i_mount, xs_dir_create);
        }
 
-       args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
+       args = kmem_zalloc(sizeof(*args), KM_NOFS);
        if (!args)
                return -ENOMEM;
 
@@ -351,7 +351,7 @@ xfs_dir_lookup(
         * lockdep Doing this avoids having to add a bunch of lockdep class
         * annotations into the reclaim path for the ilock.
         */
-       args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
+       args = kmem_zalloc(sizeof(*args), KM_NOFS);
        args->geo = dp->i_mount->m_dir_geo;
        args->name = name->name;
        args->namelen = name->len;
@@ -420,7 +420,7 @@ xfs_dir_removename(
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
        XFS_STATS_INC(dp->i_mount, xs_dir_remove);
 
-       args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
+       args = kmem_zalloc(sizeof(*args), KM_NOFS);
        if (!args)
                return -ENOMEM;
 
@@ -481,7 +481,7 @@ xfs_dir_replace(
        if (rval)
                return rval;
 
-       args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
+       args = kmem_zalloc(sizeof(*args), KM_NOFS);
        if (!args)
                return -ENOMEM;
 
index 975dd68121f987fa26c9c221b65d6ebb88bc164a..23898e3677c24785ab1a25a50fc210c85a5262d3 100644 (file)
@@ -1089,7 +1089,7 @@ xfs_dir2_sf_to_block(
         * Copy the directory into a temporary buffer.
         * Then pitch the incore inode data so we can make extents.
         */
-       sfp = kmem_alloc(ifp->if_bytes, KM_SLEEP);
+       sfp = kmem_alloc(ifp->if_bytes, 0);
        memcpy(sfp, oldsfp, ifp->if_bytes);
 
        xfs_idata_realloc(dp, -ifp->if_bytes, XFS_DATA_FORK);
index 0360c9678dd51fac0fb9ea96ae2cf88f44a30044..50bcb8a72b122c357937e6a6834d68d21aa27d7b 100644 (file)
@@ -164,7 +164,7 @@ xfs_dir2_block_to_sf(
         * can free the block and copy the formatted data into the inode literal
         * area.
         */
-       dst = kmem_alloc(mp->m_sb.sb_inodesize, KM_SLEEP);
+       dst = kmem_alloc(mp->m_sb.sb_inodesize, 0);
        hdr = bp->b_addr;
 
        /*
@@ -436,7 +436,7 @@ xfs_dir2_sf_addname_hard(
 
        sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        old_isize = (int)dp->i_d.di_size;
-       buf = kmem_alloc(old_isize, KM_SLEEP);
+       buf = kmem_alloc(old_isize, 0);
        oldsfp = (xfs_dir2_sf_hdr_t *)buf;
        memcpy(oldsfp, sfp, old_isize);
        /*
@@ -1096,7 +1096,7 @@ xfs_dir2_sf_toino4(
         * Don't want xfs_idata_realloc copying the data here.
         */
        oldsize = dp->i_df.if_bytes;
-       buf = kmem_alloc(oldsize, KM_SLEEP);
+       buf = kmem_alloc(oldsize, 0);
        oldsfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        ASSERT(oldsfp->i8count == 1);
        memcpy(buf, oldsfp, oldsize);
@@ -1169,7 +1169,7 @@ xfs_dir2_sf_toino8(
         * Don't want xfs_idata_realloc copying the data here.
         */
        oldsize = dp->i_df.if_bytes;
-       buf = kmem_alloc(oldsize, KM_SLEEP);
+       buf = kmem_alloc(oldsize, 0);
        oldsfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        ASSERT(oldsfp->i8count == 0);
        memcpy(buf, oldsfp, oldsize);
index 5e11f1f59392a52503f19a5a52164e93e22676a3..45f5e5c79d45d907fd9854c39342d7740a276fe8 100644 (file)
@@ -92,7 +92,7 @@ xfs_iformat_fork(
                return 0;
 
        ASSERT(ip->i_afp == NULL);
-       ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP | KM_NOFS);
+       ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_NOFS);
 
        switch (dip->di_aformat) {
        case XFS_DINODE_FMT_LOCAL:
@@ -145,7 +145,7 @@ xfs_init_local_fork(
 
        if (size) {
                real_size = roundup(mem_size, 4);
-               ifp->if_u1.if_data = kmem_alloc(real_size, KM_SLEEP | KM_NOFS);
+               ifp->if_u1.if_data = kmem_alloc(real_size, KM_NOFS);
                memcpy(ifp->if_u1.if_data, data, size);
                if (zero_terminate)
                        ifp->if_u1.if_data[size] = '\0';
@@ -300,7 +300,7 @@ xfs_iformat_btree(
        }
 
        ifp->if_broot_bytes = size;
-       ifp->if_broot = kmem_alloc(size, KM_SLEEP | KM_NOFS);
+       ifp->if_broot = kmem_alloc(size, KM_NOFS);
        ASSERT(ifp->if_broot != NULL);
        /*
         * Copy and convert from the on-disk structure
@@ -365,7 +365,7 @@ xfs_iroot_realloc(
                 */
                if (ifp->if_broot_bytes == 0) {
                        new_size = XFS_BMAP_BROOT_SPACE_CALC(mp, rec_diff);
-                       ifp->if_broot = kmem_alloc(new_size, KM_SLEEP | KM_NOFS);
+                       ifp->if_broot = kmem_alloc(new_size, KM_NOFS);
                        ifp->if_broot_bytes = (int)new_size;
                        return;
                }
@@ -380,7 +380,7 @@ xfs_iroot_realloc(
                new_max = cur_max + rec_diff;
                new_size = XFS_BMAP_BROOT_SPACE_CALC(mp, new_max);
                ifp->if_broot = kmem_realloc(ifp->if_broot, new_size,
-                               KM_SLEEP | KM_NOFS);
+                               KM_NOFS);
                op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
                                                     ifp->if_broot_bytes);
                np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
@@ -406,7 +406,7 @@ xfs_iroot_realloc(
        else
                new_size = 0;
        if (new_size > 0) {
-               new_broot = kmem_alloc(new_size, KM_SLEEP | KM_NOFS);
+               new_broot = kmem_alloc(new_size, KM_NOFS);
                /*
                 * First copy over the btree block header.
                 */
@@ -490,7 +490,7 @@ xfs_idata_realloc(
         * We enforce that here.
         */
        ifp->if_u1.if_data = kmem_realloc(ifp->if_u1.if_data,
-                       roundup(new_size, 4), KM_SLEEP | KM_NOFS);
+                       roundup(new_size, 4), KM_NOFS);
        ifp->if_bytes = new_size;
 }
 
@@ -681,7 +681,7 @@ xfs_ifork_init_cow(
                return;
 
        ip->i_cowfp = kmem_zone_zalloc(xfs_ifork_zone,
-                                      KM_SLEEP | KM_NOFS);
+                                      KM_NOFS);
        ip->i_cowfp->if_flags = XFS_IFEXTENTS;
        ip->i_cformat = XFS_DINODE_FMT_EXTENTS;
        ip->i_cnextents = 0;
index 8b72695929d08ed70dad45fe14cd6c5cf465bd33..a16015c8191c76449a4785319c41f7acb5451c19 100644 (file)
@@ -1187,7 +1187,7 @@ __xfs_refcount_add(
                        blockcount);
 
        ri = kmem_alloc(sizeof(struct xfs_refcount_intent),
-                       KM_SLEEP | KM_NOFS);
+                       KM_NOFS);
        INIT_LIST_HEAD(&ri->ri_list);
        ri->ri_type = type;
        ri->ri_startblock = startblock;
@@ -1600,7 +1600,7 @@ xfs_refcount_recover_extent(
        if (be32_to_cpu(rec->refc.rc_refcount) != 1)
                return -EFSCORRUPTED;
 
-       rr = kmem_alloc(sizeof(struct xfs_refcount_recovery), KM_SLEEP);
+       rr = kmem_alloc(sizeof(struct xfs_refcount_recovery), 0);
        xfs_refcount_btrec_to_irec(rec, &rr->rr_rrec);
        list_add_tail(&rr->rr_list, debris);
 
index ecdf5d40e7f9f3ef94978e6803a36beb27723c76..5c305ec599bb065a3fd4fddd29d2386aff07b4bd 100644 (file)
@@ -2285,7 +2285,7 @@ __xfs_rmap_add(
                        bmap->br_blockcount,
                        bmap->br_state);
 
-       ri = kmem_alloc(sizeof(struct xfs_rmap_intent), KM_SLEEP | KM_NOFS);
+       ri = kmem_alloc(sizeof(struct xfs_rmap_intent), KM_NOFS);
        INIT_LIST_HEAD(&ri->ri_list);
        ri->ri_type = type;
        ri->ri_owner = owner;
index ab56fcd8e44a865a945385e1cc807db2e370ecde..ae4213959a2f15313f505893bf5a2a5cfc45a61d 100644 (file)
@@ -1003,7 +1003,7 @@ xlog_recover_new_tid(
 {
        xlog_recover_t          *trans;
 
-       trans = kmem_zalloc(sizeof(xlog_recover_t), KM_SLEEP);
+       trans = kmem_zalloc(sizeof(xlog_recover_t), 0);
        trans->r_log_tid   = tid;
        trans->r_lsn       = lsn;
        INIT_LIST_HEAD(&trans->r_itemq);
@@ -1018,7 +1018,7 @@ xlog_recover_add_item(
 {
        xlog_recover_item_t     *item;
 
-       item = kmem_zalloc(sizeof(xlog_recover_item_t), KM_SLEEP);
+       item = kmem_zalloc(sizeof(xlog_recover_item_t), 0);
        INIT_LIST_HEAD(&item->ri_list);
        list_add_tail(&item->ri_list, head);
 }
@@ -1048,7 +1048,7 @@ xlog_recover_add_to_cont_trans(
        old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
        old_len = item->ri_buf[item->ri_cnt-1].i_len;
 
-       ptr = kmem_realloc(old_ptr, len+old_len, KM_SLEEP);
+       ptr = kmem_realloc(old_ptr, len+old_len, 0);
        memcpy(&ptr[old_len], dp, len); /* d, s, l */
        item->ri_buf[item->ri_cnt-1].i_len += len;
        item->ri_buf[item->ri_cnt-1].i_addr = ptr;
@@ -1096,7 +1096,7 @@ xlog_recover_add_to_trans(
                return 0;
        }
 
-       ptr = kmem_alloc(len, KM_SLEEP);
+       ptr = kmem_alloc(len, 0);
        memcpy(ptr, dp, len);
        in_f = (struct xfs_inode_log_format *)ptr;
 
@@ -1124,7 +1124,7 @@ xlog_recover_add_to_trans(
                item->ri_total = in_f->ilf_size;
                item->ri_buf =
                        kmem_zalloc(item->ri_total * sizeof(xfs_log_iovec_t),
-                                   KM_SLEEP);
+                                   0);
        }
        ASSERT(item->ri_total > item->ri_cnt);
        /* Description region is ri_buf[0] */