[PATCH] xfs: allow changing extsize on file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave, this is more a question than a patch.

We are current disallowing the change of extsize on files/dirs if the file/dir
have blocks allocated. That's not that friendly to users. Say somehow the
extsize was set very huge (1GiB), in the following cases, it's not that
convenient:
case 1: the file now extends very little. -- 1GiB extsize leads a waste of
        almost 1GiB.
case 2: when CoW happens, 1GiB is preallocated. 1GiB is now too big for the
        IO pattern, so the huge preallocting and then reclaiming is not necessary
        and that cost extra time especially when the system if fragmented.

In above cases, changing extsize smaller is needed.

In theory, the exthint is a hint for future allocation, I can't connect it
to the blocks which are already allocated to the file/dir.
So the only reason why we disallow that is that there might be some problems if
we allow it.  Well, can we fix the real problem(s) rather than disallowing
extsize changing?

Signed-off-by: Wengang Wang <wen.gang.wang@xxxxxxxxxx>
---
 fs/xfs/xfs_ioctl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index d0e2cec6210d..b34992d9932f 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1221,8 +1221,7 @@ xfs_ioctl_setattr_get_trans(
 }
 
 /*
- * Validate a proposed extent size hint.  For regular files, the hint can only
- * be changed if no extents are allocated.
+ * Validate a proposed extent size hint.
  */
 static int
 xfs_ioctl_setattr_check_extsize(
@@ -1236,10 +1235,6 @@ xfs_ioctl_setattr_check_extsize(
 	if (!fa->fsx_valid)
 		return 0;
 
-	if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
-	    XFS_FSB_TO_B(mp, ip->i_extsize) != fa->fsx_extsize)
-		return -EINVAL;
-
 	if (fa->fsx_extsize & mp->m_blockmask)
 		return -EINVAL;
 
-- 
2.39.3 (Apple Git-146)





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux