[PATCH 9/9] spaceman/defrag: warn on extsize

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

 



According to current kernel implemenation, non-zero extsize might affect
the result of defragmentation.
Just print a warning on that if non-zero extsize is set on file.

Signed-off-by: Wengang Wang <wen.gang.wang@xxxxxxxxxx>
---
 spaceman/defrag.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/spaceman/defrag.c b/spaceman/defrag.c
index ab8508bb..b6b89dd9 100644
--- a/spaceman/defrag.c
+++ b/spaceman/defrag.c
@@ -526,6 +526,18 @@ defrag_xfs_defrag(char *file_path) {
 		goto out;
 	}
 
+       if (ioctl(defrag_fd, FS_IOC_FSGETXATTR, &fsx) < 0) {
+               fprintf(stderr, "FSGETXATTR failed %s\n",
+                       strerror(errno));
+               ret = 1;
+               goto out;
+       }
+
+       if (fsx.fsx_extsize != 0)
+               fprintf(stderr, "%s has extsize set %d. That might affect defrag "
+                       "according to kernel implementation\n",
+                       file_path, fsx.fsx_extsize);
+
 	clone.src_fd = defrag_fd;
 
 	defrag_dir = dirname(file_path);
-- 
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