Skip to content

Commit ca4f258

Browse files
cmaiolinodjwong
authored andcommitted
xfs: Modify xlog_ticket_alloc() to use kernel's MM API
xlog_ticket_alloc() is always called under NOFS context, except from unmount path, which eitherway is holding many FS locks, so, there is no need for its callers to keep passing allocation flags into it. change xlog_ticket_alloc() to use default kmem_cache_zalloc(), remove its alloc_flags argument, and always use GFP_NOFS | __GFP_NOFAIL flags. 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 32a2b11 commit ca4f258

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

fs/xfs/xfs_log.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ xfs_log_reserve(
433433
XFS_STATS_INC(mp, xs_try_logspace);
434434

435435
ASSERT(*ticp == NULL);
436-
tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent, 0);
436+
tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent);
437437
*ticp = tic;
438438

439439
xlog_grant_push_ail(log, tic->t_cnt ? tic->t_unit_res * tic->t_cnt
@@ -3408,15 +3408,12 @@ xlog_ticket_alloc(
34083408
int unit_bytes,
34093409
int cnt,
34103410
char client,
3411-
bool permanent,
3412-
xfs_km_flags_t alloc_flags)
3411+
bool permanent)
34133412
{
34143413
struct xlog_ticket *tic;
34153414
int unit_res;
34163415

3417-
tic = kmem_zone_zalloc(xfs_log_ticket_zone, alloc_flags);
3418-
if (!tic)
3419-
return NULL;
3416+
tic = kmem_cache_zalloc(xfs_log_ticket_zone, GFP_NOFS | __GFP_NOFAIL);
34203417

34213418
unit_res = xfs_log_calc_unit_res(log->l_mp, unit_bytes);
34223419

fs/xfs/xfs_log_cil.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ xlog_cil_ticket_alloc(
3737
{
3838
struct xlog_ticket *tic;
3939

40-
tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0,
41-
KM_NOFS);
40+
tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0);
4241

4342
/*
4443
* set the current reservation to zero so we know to steal the basic

fs/xfs/xfs_log_priv.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,7 @@ xlog_ticket_alloc(
464464
int unit_bytes,
465465
int count,
466466
char client,
467-
bool permanent,
468-
xfs_km_flags_t alloc_flags);
469-
467+
bool permanent);
470468

471469
static inline void
472470
xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)

0 commit comments

Comments
 (0)