* [PATCH 0/2] Addadd FALLOC_FL_WRITE_ZEROES support to xfs @ 2026-03-09 18:07 Lukas Herbolt 2026-03-09 18:07 ` [PATCH 1/2] xfs: Introduce 'bmapi_flags' parameter to xfs_alloc_file_space() Lukas Herbolt 0 siblings, 1 reply; 3+ messages in thread From: Lukas Herbolt @ 2026-03-09 18:07 UTC (permalink / raw) To: linux-xfs; +Cc: cem, hch, djwong, p.raghav This is addtion of the FALLOC_FL_WRITE_ZEROES into the XFS. As suggested this is split into two patches firts one introduce the bmapi_flags for xfs_alloc_file_space. Second patch implements the FALLOC_FL_WRITE_ZEROES doing it in two steps, first preallocates and then converts it to zeroed. Sending first patch as v0 and second as v11 to make the changes visible. The first patch is just changes to Doing the tho phase allocation t Lukas Herbolt (2): xfs: Introduce 'bmapi_flags' parameter to xfs_alloc_file_space() xfs: add FALLOC_FL_WRITE_ZEROES to XFS code base fs/xfs/xfs_bmap_util.c | 5 +++-- fs/xfs/xfs_bmap_util.h | 2 +- fs/xfs/xfs_file.c | 47 ++++++++++++++++++++++++++++++------------ 3 files changed, 38 insertions(+), 16 deletions(-) -- 2.53.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] xfs: Introduce 'bmapi_flags' parameter to xfs_alloc_file_space() 2026-03-09 18:07 [PATCH 0/2] Addadd FALLOC_FL_WRITE_ZEROES support to xfs Lukas Herbolt @ 2026-03-09 18:07 ` Lukas Herbolt 2026-03-10 0:31 ` Darrick J. Wong 0 siblings, 1 reply; 3+ messages in thread From: Lukas Herbolt @ 2026-03-09 18:07 UTC (permalink / raw) To: linux-xfs; +Cc: cem, hch, djwong, p.raghav, Lukas Herbolt Add bmapi_flags to xfs_alloc_file_space for future use with FALLOC_FL_WRITE_ZEROES new fallocate mode. This allows callers to explicitly pass the required XFS_BMAPI_* allocation flags. Update all existing callers to pass XFS_BMAPI_PREALLOC to maintain the current behavior. No functional changes intended. Co-developed-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Lukas Herbolt <lukas@herbolt.com> --- fs/xfs/xfs_bmap_util.c | 5 +++-- fs/xfs/xfs_bmap_util.h | 2 +- fs/xfs/xfs_file.c | 9 ++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 2208a720ec3f..e92f9cd05f52 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -646,7 +646,8 @@ int xfs_alloc_file_space( struct xfs_inode *ip, xfs_off_t offset, - xfs_off_t len) + xfs_off_t len, + uint32_t bmapi_flags) { xfs_mount_t *mp = ip->i_mount; xfs_off_t count; @@ -748,7 +749,7 @@ xfs_alloc_file_space( * will eventually reach the requested range. */ error = xfs_bmapi_write(tp, ip, startoffset_fsb, - allocatesize_fsb, XFS_BMAPI_PREALLOC, 0, imapp, + allocatesize_fsb, bmapi_flags, 0, imapp, &nimaps); if (error) { if (error != -ENOSR) diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h index c477b3361630..2895cc97a572 100644 --- a/fs/xfs/xfs_bmap_util.h +++ b/fs/xfs/xfs_bmap_util.h @@ -56,7 +56,7 @@ int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip, /* preallocation and hole punch interface */ int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset, - xfs_off_t len); + xfs_off_t len, uint32_t bmapi_flags); int xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset, xfs_off_t len, struct xfs_zone_alloc_ctx *ac); int xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset, diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 7874cf745af3..fd049a1fc9c6 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1310,7 +1310,8 @@ xfs_falloc_zero_range( len = round_up(offset + len, blksize) - round_down(offset, blksize); offset = round_down(offset, blksize); - error = xfs_alloc_file_space(ip, offset, len); + error = xfs_alloc_file_space(ip, offset, len, + XFS_BMAPI_PREALLOC); } if (error) return error; @@ -1336,7 +1337,8 @@ xfs_falloc_unshare_range( if (error) return error; - error = xfs_alloc_file_space(XFS_I(inode), offset, len); + error = xfs_alloc_file_space(XFS_I(inode), offset, len, + XFS_BMAPI_PREALLOC); if (error) return error; return xfs_falloc_setsize(file, new_size); @@ -1364,7 +1366,8 @@ xfs_falloc_allocate_range( if (error) return error; - error = xfs_alloc_file_space(XFS_I(inode), offset, len); + error = xfs_alloc_file_space(XFS_I(inode), offset, len, + XFS_BMAPI_PREALLOC); if (error) return error; return xfs_falloc_setsize(file, new_size); -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] xfs: Introduce 'bmapi_flags' parameter to xfs_alloc_file_space() 2026-03-09 18:07 ` [PATCH 1/2] xfs: Introduce 'bmapi_flags' parameter to xfs_alloc_file_space() Lukas Herbolt @ 2026-03-10 0:31 ` Darrick J. Wong 0 siblings, 0 replies; 3+ messages in thread From: Darrick J. Wong @ 2026-03-10 0:31 UTC (permalink / raw) To: Lukas Herbolt; +Cc: linux-xfs, cem, hch, p.raghav On Mon, Mar 09, 2026 at 07:07:09PM +0100, Lukas Herbolt wrote: > Add bmapi_flags to xfs_alloc_file_space for future use with > FALLOC_FL_WRITE_ZEROES new fallocate mode. This allows callers to > explicitly pass the required XFS_BMAPI_* allocation flags. > > Update all existing callers to pass XFS_BMAPI_PREALLOC to maintain > the current behavior. No functional changes intended. > > Co-developed-by: Pankaj Raghav <p.raghav@samsung.com> > Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> > Signed-off-by: Lukas Herbolt <lukas@herbolt.com> Looks ok, Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> --D > > --- > fs/xfs/xfs_bmap_util.c | 5 +++-- > fs/xfs/xfs_bmap_util.h | 2 +- > fs/xfs/xfs_file.c | 9 ++++++--- > 3 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > index 2208a720ec3f..e92f9cd05f52 100644 > --- a/fs/xfs/xfs_bmap_util.c > +++ b/fs/xfs/xfs_bmap_util.c > @@ -646,7 +646,8 @@ int > xfs_alloc_file_space( > struct xfs_inode *ip, > xfs_off_t offset, > - xfs_off_t len) > + xfs_off_t len, > + uint32_t bmapi_flags) > { > xfs_mount_t *mp = ip->i_mount; > xfs_off_t count; > @@ -748,7 +749,7 @@ xfs_alloc_file_space( > * will eventually reach the requested range. > */ > error = xfs_bmapi_write(tp, ip, startoffset_fsb, > - allocatesize_fsb, XFS_BMAPI_PREALLOC, 0, imapp, > + allocatesize_fsb, bmapi_flags, 0, imapp, > &nimaps); > if (error) { > if (error != -ENOSR) > diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h > index c477b3361630..2895cc97a572 100644 > --- a/fs/xfs/xfs_bmap_util.h > +++ b/fs/xfs/xfs_bmap_util.h > @@ -56,7 +56,7 @@ int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip, > > /* preallocation and hole punch interface */ > int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset, > - xfs_off_t len); > + xfs_off_t len, uint32_t bmapi_flags); > int xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset, > xfs_off_t len, struct xfs_zone_alloc_ctx *ac); > int xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset, > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index 7874cf745af3..fd049a1fc9c6 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -1310,7 +1310,8 @@ xfs_falloc_zero_range( > len = round_up(offset + len, blksize) - > round_down(offset, blksize); > offset = round_down(offset, blksize); > - error = xfs_alloc_file_space(ip, offset, len); > + error = xfs_alloc_file_space(ip, offset, len, > + XFS_BMAPI_PREALLOC); > } > if (error) > return error; > @@ -1336,7 +1337,8 @@ xfs_falloc_unshare_range( > if (error) > return error; > > - error = xfs_alloc_file_space(XFS_I(inode), offset, len); > + error = xfs_alloc_file_space(XFS_I(inode), offset, len, > + XFS_BMAPI_PREALLOC); > if (error) > return error; > return xfs_falloc_setsize(file, new_size); > @@ -1364,7 +1366,8 @@ xfs_falloc_allocate_range( > if (error) > return error; > > - error = xfs_alloc_file_space(XFS_I(inode), offset, len); > + error = xfs_alloc_file_space(XFS_I(inode), offset, len, > + XFS_BMAPI_PREALLOC); > if (error) > return error; > return xfs_falloc_setsize(file, new_size); > -- > 2.53.0 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-10 0:31 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-09 18:07 [PATCH 0/2] Addadd FALLOC_FL_WRITE_ZEROES support to xfs Lukas Herbolt 2026-03-09 18:07 ` [PATCH 1/2] xfs: Introduce 'bmapi_flags' parameter to xfs_alloc_file_space() Lukas Herbolt 2026-03-10 0:31 ` Darrick J. Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox