From: Christoph Hellwig <hch@lst.de>
To: Andrey Albershteyn <aalbersh@kernel.org>
Cc: "Darrick J . Wong " <djwong@kernel.org>,
Eric Sandeen <sandeen@redhat.com>,
Carlos Maiolino <cem@kernel.org>,
linux-xfs@vger.kernel.org
Subject: [PATCH 08/13] libxfs: remove libxfs_trans_alloc_rollable
Date: Mon, 5 Oct 2026 14:56:18 +0200 [thread overview]
Message-ID: <20261005125637.1340355-9-hch@lst.de> (raw)
In-Reply-To: <20261005125637.1340355-1-hch@lst.de>
There is no real value in this userland-only wrapper. Remove it and
open code the calls, and switch to clearly better fitting transaction
reservations where applicable.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
libxfs/stubs/xfs_trans.h | 2 --
libxfs/trans.c | 15 ---------------
mkfs/proto.c | 8 +++++---
mkfs/xfs_mkfs.c | 3 ++-
repair/phase5.c | 3 ++-
repair/phase6.c | 3 ++-
repair/rmap.c | 5 +++--
7 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/libxfs/stubs/xfs_trans.h b/libxfs/stubs/xfs_trans.h
index 1117aad80c2f..9e8737f09d8e 100644
--- a/libxfs/stubs/xfs_trans.h
+++ b/libxfs/stubs/xfs_trans.h
@@ -88,8 +88,6 @@ int libxfs_trans_alloc_inode(struct xfs_inode *ip, struct xfs_trans_res *resv,
int libxfs_trans_alloc_dir(struct xfs_inode *dp, struct xfs_trans_res *resv,
struct xfs_inode *ip, unsigned int *dblocks,
struct xfs_trans **tpp, int *nospace_error);
-int libxfs_trans_alloc_rollable(struct xfs_mount *mp, uint blocks,
- struct xfs_trans **tpp);
struct xfs_trans *libxfs_trans_alloc_empty(struct xfs_mount *mp);
int libxfs_trans_commit(struct xfs_trans *);
void libxfs_trans_cancel(struct xfs_trans *);
diff --git a/libxfs/trans.c b/libxfs/trans.c
index aa303288a81c..f36c54b9c806 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -306,21 +306,6 @@ libxfs_trans_alloc_empty(
return __libxfs_trans_alloc(mp, XFS_TRANS_NO_WRITECOUNT);
}
-/*
- * Allocate a transaction that can be rolled. Since userspace doesn't have
- * a need for log reservations, we really only tr_itruncate to get the
- * permanent log reservation flag to avoid blowing asserts.
- */
-int
-libxfs_trans_alloc_rollable(
- struct xfs_mount *mp,
- unsigned int blocks,
- struct xfs_trans **tpp)
-{
- return libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, blocks,
- 0, 0, tpp);
-}
-
void
libxfs_trans_cancel(
struct xfs_trans *tp)
diff --git a/mkfs/proto.c b/mkfs/proto.c
index bdd0fadda517..f17ed3b88112 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -161,7 +161,8 @@ getres(
uint r;
for (i = 0, r = MKFS_BLOCKRES(blocks); r >= blocks; r--) {
- i = -libxfs_trans_alloc_rollable(mp, r, &tp);
+ i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, r, 0, 0,
+ &tp);
if (i == 0)
return tp;
}
@@ -251,7 +252,7 @@ rsvfile(
/*
* update the inode timestamp, mode, and prealloc flag bits
*/
- error = -libxfs_trans_alloc_rollable(mp, 0, &tp);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp);
if (error)
fail(_("allocating transaction for a file"), error);
libxfs_trans_ijoin(tp, ip, 0);
@@ -1037,7 +1038,8 @@ create_sb_metadata_file(
xfs_ino_t ino;
int error;
- error = -libxfs_trans_alloc_rollable(mp, MKFS_BLOCKRES_INODE, &tp);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_create,
+ MKFS_BLOCKRES_INODE, 0, 0, &tp);
if (error)
res_failed(error);
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index aa87951db0d0..eb863827d19c 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -5706,7 +5706,8 @@ initialise_ag_freespace(
struct xfs_trans *tp;
int c;
- c = -libxfs_trans_alloc_rollable(mp, worst_freelist, &tp);
+ c = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, worst_freelist,
+ 0, 0, &tp);
if (c)
res_failed(c);
diff --git a/repair/phase5.c b/repair/phase5.c
index e44c26885717..4c67d049702b 100644
--- a/repair/phase5.c
+++ b/repair/phase5.c
@@ -610,7 +610,8 @@ inject_lost_extent(
xfs_agblock_t agbno;
int error;
- error = -libxfs_trans_alloc_rollable(mp, 16, &tp);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 16, 0, 0,
+ &tp);
if (error)
return error;
diff --git a/repair/phase6.c b/repair/phase6.c
index f3951a3d0709..f6f985a92541 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -507,7 +507,8 @@ mk_rtino(
libxfs_rtginode_metafile_type(type);
int error;
- error = -libxfs_trans_alloc_rollable(mp, 10, &tp);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 10, 0, 0,
+ &tp);
if (error)
res_failed(error);
diff --git a/repair/rmap.c b/repair/rmap.c
index 55c2b0928c52..9f824f848edc 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -714,7 +714,8 @@ rmap_commit_agbtree_mappings(
struct xfs_owner_info oinfo = {};
struct xfs_perag *pag;
- error = -libxfs_trans_alloc_rollable(mp, 16, &tp);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 16, 0,
+ 0, &tp);
if (error)
goto err_slab;
@@ -1952,7 +1953,7 @@ fix_freelist(
args.agno = agno;
args.alignment = 1;
args.pag = libxfs_perag_get(mp, agno);
- error = -libxfs_trans_alloc_rollable(mp, 0, &tp);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
if (error)
do_error(_("failed to fix AGFL on AG %d, error %d\n"),
agno, error);
--
2.53.0
next prev parent reply other threads:[~2026-10-05 12:57 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 12:56 reduce libxfs to kernel differences v2 Christoph Hellwig
2026-10-05 12:56 ` [PATCH 01/13] libxfs: use libxfs.h in xfs_platform.h Christoph Hellwig
2026-10-05 21:44 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 02/13] libxfs: provide memalloc_nofs_{save,restore} stubs Christoph Hellwig
2026-10-05 21:45 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 03/13] libxfs: remove a spurious xfs_rtbitmap.h include in xfs_sb.c Christoph Hellwig
2026-10-05 21:45 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 04/13] libxfs: move the xfs_rtbitmap.h include in xfs_bmap.c Christoph Hellwig
2026-10-06 11:27 ` Andrey Albershteyn
2026-10-05 12:56 ` [PATCH 05/13] libxfs: remove the unused xfs_log_item.li_mountp field Christoph Hellwig
2026-10-05 21:46 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 06/13] libxfs: remove the unused xfs_inode_log_item.ili_fsync_fields field Christoph Hellwig
2026-10-05 21:46 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 07/13] libxfs: remove the xfs_log_item_t and xfs_buf_log_item_t typedefs Christoph Hellwig
2026-10-05 21:46 ` Darrick J. Wong
2026-10-05 12:56 ` Christoph Hellwig [this message]
2026-10-05 21:47 ` [PATCH 08/13] libxfs: remove libxfs_trans_alloc_rollable Darrick J. Wong
2026-10-05 12:56 ` [PATCH 09/13] libxfs: return int from xfs_buf_item_init Christoph Hellwig
2026-10-05 21:48 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 10/13] libxfs: use xfs_buf_item.h and xfs_inode_item.h from the kernel source Christoph Hellwig
2026-10-05 21:48 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 11/13] libxfs: cleanup xfs_trans.h Christoph Hellwig
2026-10-05 21:48 ` Darrick J. Wong
2026-10-05 12:56 ` [PATCH 12/13] libxfs: use xfs_trans.h from the kernel source Christoph Hellwig
2026-10-05 21:49 ` Darrick J. Wong
2026-10-07 13:41 ` Christoph Hellwig
2026-10-07 15:18 ` Darrick J. Wong
2026-10-08 10:59 ` Carlos Maiolino
2026-10-05 12:56 ` [PATCH 13/13] libxfs: use all log item headers from the kernel Christoph Hellwig
2026-10-05 21:50 ` Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2026-09-25 15:20 reduce libxfs to kernel differences Christoph Hellwig
2026-09-25 15:20 ` [PATCH 08/13] libxfs: remove libxfs_trans_alloc_rollable Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261005125637.1340355-9-hch@lst.de \
--to=hch@lst.de \
--cc=aalbersh@kernel.org \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox