Skip to content

Commit

Permalink
xfs: Modify xlog_ticket_alloc() to use kernel's MM API
Browse files Browse the repository at this point in the history
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 <hch@lst.de>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
  • Loading branch information
cmaiolino authored and djwong committed Jul 29, 2020
1 parent 32a2b11 commit ca4f258
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ xfs_log_reserve(
XFS_STATS_INC(mp, xs_try_logspace);

ASSERT(*ticp == NULL);
tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent, 0);
tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent);
*ticp = tic;

xlog_grant_push_ail(log, tic->t_cnt ? tic->t_unit_res * tic->t_cnt
Expand Down Expand Up @@ -3408,15 +3408,12 @@ xlog_ticket_alloc(
int unit_bytes,
int cnt,
char client,
bool permanent,
xfs_km_flags_t alloc_flags)
bool permanent)
{
struct xlog_ticket *tic;
int unit_res;

tic = kmem_zone_zalloc(xfs_log_ticket_zone, alloc_flags);
if (!tic)
return NULL;
tic = kmem_cache_zalloc(xfs_log_ticket_zone, GFP_NOFS | __GFP_NOFAIL);

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

Expand Down
3 changes: 1 addition & 2 deletions fs/xfs/xfs_log_cil.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ xlog_cil_ticket_alloc(
{
struct xlog_ticket *tic;

tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0,
KM_NOFS);
tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0);

/*
* set the current reservation to zero so we know to steal the basic
Expand Down
4 changes: 1 addition & 3 deletions fs/xfs/xfs_log_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,7 @@ xlog_ticket_alloc(
int unit_bytes,
int count,
char client,
bool permanent,
xfs_km_flags_t alloc_flags);

bool permanent);

static inline void
xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)
Expand Down

0 comments on commit ca4f258

Please sign in to comment.