Skip to content

Commit 32a2b11

Browse files
cmaiolinodjwong
authored andcommitted
xfs: Remove kmem_zone_zalloc() usage
Use kmem_cache_zalloc() directly. With the exception of xlog_ticket_alloc() which will be dealt on the next patch for readability. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent 3050bd0 commit 32a2b11

19 files changed

+35
-28
lines changed

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ xfs_allocbt_init_common(
480480

481481
ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);
482482

483-
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);
483+
cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
484484

485485
cur->bc_tp = tp;
486486
cur->bc_mp = mp;

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,10 @@ xfs_bmap_add_attrfork(
10991099
if (error)
11001100
goto trans_cancel;
11011101
ASSERT(ip->i_afp == NULL);
1102-
ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, 0);
1102+
1103+
ip->i_afp = kmem_cache_zalloc(xfs_ifork_zone,
1104+
GFP_KERNEL | __GFP_NOFAIL);
1105+
11031106
ip->i_afp->if_format = XFS_DINODE_FMT_EXTENTS;
11041107
ip->i_afp->if_flags = XFS_IFEXTENTS;
11051108
logflags = 0;

fs/xfs/libxfs/xfs_bmap_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ xfs_bmbt_init_cursor(
552552
struct xfs_btree_cur *cur;
553553
ASSERT(whichfork != XFS_COW_FORK);
554554

555-
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);
555+
cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
556556

557557
cur->bc_tp = tp;
558558
cur->bc_mp = mp;

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ kmem_zone_t *xfs_da_state_zone; /* anchor for state struct zone */
8181
xfs_da_state_t *
8282
xfs_da_state_alloc(void)
8383
{
84-
return kmem_zone_zalloc(xfs_da_state_zone, KM_NOFS);
84+
return kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
8585
}
8686

8787
/*

fs/xfs/libxfs/xfs_ialloc_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ xfs_inobt_init_common(
411411
{
412412
struct xfs_btree_cur *cur;
413413

414-
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);
414+
cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
415415
cur->bc_tp = tp;
416416
cur->bc_mp = mp;
417417
cur->bc_btnum = btnum;

fs/xfs/libxfs/xfs_inode_fork.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ xfs_iformat_attr_fork(
291291
* Initialize the extent count early, as the per-format routines may
292292
* depend on it.
293293
*/
294-
ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_NOFS);
294+
ip->i_afp = kmem_cache_zalloc(xfs_ifork_zone, GFP_NOFS | __GFP_NOFAIL);
295295
ip->i_afp->if_format = dip->di_aformat;
296296
if (unlikely(ip->i_afp->if_format == 0)) /* pre IRIX 6.2 file system */
297297
ip->i_afp->if_format = XFS_DINODE_FMT_EXTENTS;
@@ -673,8 +673,8 @@ xfs_ifork_init_cow(
673673
if (ip->i_cowfp)
674674
return;
675675

676-
ip->i_cowfp = kmem_zone_zalloc(xfs_ifork_zone,
677-
KM_NOFS);
676+
ip->i_cowfp = kmem_cache_zalloc(xfs_ifork_zone,
677+
GFP_NOFS | __GFP_NOFAIL);
678678
ip->i_cowfp->if_flags = XFS_IFEXTENTS;
679679
ip->i_cowfp->if_format = XFS_DINODE_FMT_EXTENTS;
680680
}

fs/xfs/libxfs/xfs_refcount_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ xfs_refcountbt_init_common(
323323
ASSERT(agno != NULLAGNUMBER);
324324
ASSERT(agno < mp->m_sb.sb_agcount);
325325

326-
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);
326+
cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
327327
cur->bc_tp = tp;
328328
cur->bc_mp = mp;
329329
cur->bc_btnum = XFS_BTNUM_REFC;

fs/xfs/libxfs/xfs_rmap_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ xfs_rmapbt_init_common(
456456
{
457457
struct xfs_btree_cur *cur;
458458

459-
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);
459+
cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
460460
cur->bc_tp = tp;
461461
cur->bc_mp = mp;
462462
/* Overlapping btree; 2 keys per pointer. */

fs/xfs/xfs_bmap_item.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ xfs_bui_init(
138138
{
139139
struct xfs_bui_log_item *buip;
140140

141-
buip = kmem_zone_zalloc(xfs_bui_zone, 0);
141+
buip = kmem_cache_zalloc(xfs_bui_zone, GFP_KERNEL | __GFP_NOFAIL);
142142

143143
xfs_log_item_init(mp, &buip->bui_item, XFS_LI_BUI, &xfs_bui_item_ops);
144144
buip->bui_format.bui_nextents = XFS_BUI_MAX_FAST_EXTENTS;
@@ -215,7 +215,7 @@ xfs_trans_get_bud(
215215
{
216216
struct xfs_bud_log_item *budp;
217217

218-
budp = kmem_zone_zalloc(xfs_bud_zone, 0);
218+
budp = kmem_cache_zalloc(xfs_bud_zone, GFP_KERNEL | __GFP_NOFAIL);
219219
xfs_log_item_init(tp->t_mountp, &budp->bud_item, XFS_LI_BUD,
220220
&xfs_bud_item_ops);
221221
budp->bud_buip = buip;

fs/xfs/xfs_buf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ _xfs_buf_alloc(
214214
int i;
215215

216216
*bpp = NULL;
217-
bp = kmem_zone_zalloc(xfs_buf_zone, KM_NOFS);
218-
if (unlikely(!bp))
219-
return -ENOMEM;
217+
bp = kmem_cache_zalloc(xfs_buf_zone, GFP_NOFS | __GFP_NOFAIL);
220218

221219
/*
222220
* We don't want certain flags to appear in b_flags unless they are

0 commit comments

Comments
 (0)