Skip to content

Commit 6a94b1a

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: reinstate delalloc for RT inodes (if sb_rextsize == 1)
Commit aff3a9e ("xfs: Use preallocation for inodes with extsz hints") disabled delayed allocation for all inodes with extent size hints due a data exposure problem. It turns out we fixed this data exposure problem since by always creating unwritten extents for delalloc conversions due to more data exposure problems, but the writeback path doesn't actually support extent size hints when converting delalloc these days, which probably isn't a problem given that people using the hints know what they get. However due to the way how xfs_get_extsz_hint is implemented, it always claims an extent size hint for RT inodes even if the RT extent size is a single FSB. Due to that the above commit effectively disabled delalloc support for RT inodes. Switch xfs_get_extsz_hint to return 0 for this case and work around that in a few places to reinstate delalloc support for RT inodes on file systems with an sb_rextsize of 1. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: "Darrick J. Wong" <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent bd1753d commit 6a94b1a

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

fs/xfs/xfs_inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ xfs_get_extsz_hint(
5858
return 0;
5959
if ((ip->i_diflags & XFS_DIFLAG_EXTSIZE) && ip->i_extsize)
6060
return ip->i_extsize;
61-
if (XFS_IS_REALTIME_INODE(ip))
61+
if (XFS_IS_REALTIME_INODE(ip) &&
62+
ip->i_mount->m_sb.sb_rextsize > 1)
6263
return ip->i_mount->m_sb.sb_rextsize;
6364
return 0;
6465
}

fs/xfs/xfs_iomap.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,6 @@ xfs_buffered_write_iomap_begin(
10011001
return xfs_direct_write_iomap_begin(inode, offset, count,
10021002
flags, iomap, srcmap);
10031003

1004-
ASSERT(!XFS_IS_REALTIME_INODE(ip));
1005-
10061004
error = xfs_qm_dqattach(ip);
10071005
if (error)
10081006
return error;

fs/xfs/xfs_iops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ xfs_stat_blksize(
525525
* always return the realtime extent size.
526526
*/
527527
if (XFS_IS_REALTIME_INODE(ip))
528-
return XFS_FSB_TO_B(mp, xfs_get_extsz_hint(ip));
528+
return XFS_FSB_TO_B(mp, xfs_get_extsz_hint(ip) ? : 1);
529529

530530
/*
531531
* Allow large block sizes to be reported to userspace programs if the

fs/xfs/xfs_rtalloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,8 @@ xfs_bmap_rtalloc(
13411341
int error;
13421342

13431343
align = xfs_get_extsz_hint(ap->ip);
1344+
if (!align)
1345+
align = 1;
13441346
retry:
13451347
error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev,
13461348
align, 1, ap->eof, 0,

0 commit comments

Comments
 (0)