diff options
| author | Christoph Hellwig <[email protected]> | 2025-07-16 12:43:12 +0000 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-07-24 15:30:13 +0000 |
| commit | f1cc16e1547e7be4245755be27bb11027344b4d0 (patch) | |
| tree | c90f9349102c4e7aad33cf744a4084fd4adc1c5c | |
| parent | xfs: use xfs_trans_reserve_more in xfs_trans_reserve_more_inode (diff) | |
| download | kernel-f1cc16e1547e7be4245755be27bb11027344b4d0.tar.gz kernel-f1cc16e1547e7be4245755be27bb11027344b4d0.zip | |
xfs: don't use xfs_trans_reserve in xfs_trans_reserve_more
xfs_trans_reserve_more just tries to allocate additional blocks and/or
rtextents and is otherwise unrelated to the transaction reservation
logic. Open code the block and rtextent reservation in
xfs_trans_reserve_more to prepare for simplifying xfs_trans_reserve.
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Carlos Maiolino <[email protected]>
| -rw-r--r-- | fs/xfs/xfs_trans.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 8b15bfe68774..2213cb2278d2 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -1146,9 +1146,18 @@ xfs_trans_reserve_more( unsigned int blocks, unsigned int rtextents) { - struct xfs_trans_res resv = { }; + bool rsvd = tp->t_flags & XFS_TRANS_RESERVE; - return xfs_trans_reserve(tp, &resv, blocks, rtextents); + if (blocks && xfs_dec_fdblocks(tp->t_mountp, blocks, rsvd)) + return -ENOSPC; + if (rtextents && xfs_dec_frextents(tp->t_mountp, rtextents)) { + if (blocks) + xfs_add_fdblocks(tp->t_mountp, blocks); + return -ENOSPC; + } + tp->t_blk_res += blocks; + tp->t_rtx_res += rtextents; + return 0; } /* |
