Message ID | 20240621100540.2976618-13-john.g.garry@oracle.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | forcealign for xfs | expand |
On Fri, Jun 21, 2024 at 10:05:39AM +0000, John Garry wrote: > In xfs_bmap_process_allocated_extent(), for when we found that we could not > provide the requested length completely, the mapping is moved so that we > can provide as much as possible for the original request. > > For forcealign, this would mean ignoring alignment guaranteed, so don't do > this. > > Signed-off-by: John Garry <john.g.garry@oracle.com> Makes sense, Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > --- > fs/xfs/libxfs/xfs_bmap.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > index ebeb2969b289..42f3582c1574 100644 > --- a/fs/xfs/libxfs/xfs_bmap.c > +++ b/fs/xfs/libxfs/xfs_bmap.c > @@ -3492,11 +3492,15 @@ xfs_bmap_process_allocated_extent( > * original request as possible. Free space is apparently > * very fragmented so we're unlikely to be able to satisfy the > * hints anyway. > + * However, for an inode with forcealign, continue with the > + * found offset as we need to honour the alignment hint. > */ > - if (ap->length <= orig_length) > - ap->offset = orig_offset; > - else if (ap->offset + ap->length < orig_offset + orig_length) > - ap->offset = orig_offset + orig_length - ap->length; > + if (!xfs_inode_has_forcealign(ap->ip)) { > + if (ap->length <= orig_length) > + ap->offset = orig_offset; > + else if (ap->offset + ap->length < orig_offset + orig_length) > + ap->offset = orig_offset + orig_length - ap->length; > + } > xfs_bmap_alloc_account(ap); > } > > -- > 2.31.1 > >
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index ebeb2969b289..42f3582c1574 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3492,11 +3492,15 @@ xfs_bmap_process_allocated_extent( * original request as possible. Free space is apparently * very fragmented so we're unlikely to be able to satisfy the * hints anyway. + * However, for an inode with forcealign, continue with the + * found offset as we need to honour the alignment hint. */ - if (ap->length <= orig_length) - ap->offset = orig_offset; - else if (ap->offset + ap->length < orig_offset + orig_length) - ap->offset = orig_offset + orig_length - ap->length; + if (!xfs_inode_has_forcealign(ap->ip)) { + if (ap->length <= orig_length) + ap->offset = orig_offset; + else if (ap->offset + ap->length < orig_offset + orig_length) + ap->offset = orig_offset + orig_length - ap->length; + } xfs_bmap_alloc_account(ap); }
In xfs_bmap_process_allocated_extent(), for when we found that we could not provide the requested length completely, the mapping is moved so that we can provide as much as possible for the original request. For forcealign, this would mean ignoring alignment guaranteed, so don't do this. Signed-off-by: John Garry <john.g.garry@oracle.com> --- fs/xfs/libxfs/xfs_bmap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)