]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e4defrag: return more specific error message on ioctl failure
authorPeng Tao <bergwolf@gmail.com>
Mon, 13 Dec 2010 14:44:57 +0000 (09:44 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 13 Dec 2010 14:44:57 +0000 (09:44 -0500)
Currently e4defrag relies on the EXT4_IOC_MOVE_EXT ioctl to perform online
defragmentation. However, this iotcl kernel patch is not available before
2.6.30-rc1. e4defrag shall fail without obvious reasons on systems running
older kernels. The patch adds more detailed error message addressing this
issue and prompts users with the minimal kernel version that is needed to
run e4defrag.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/e4defrag.c

index 8b0894f7a1d23bf03e39ec3aa45f41da99c493ca..5b72cfacae6662fff19f63b705d98287b7096b35 100644 (file)
@@ -1514,7 +1514,11 @@ static int call_defrag(int fd, int donor_fd, const char *file,
                        if (mode_flag & DETAIL) {
                                printf("\n");
                                PRINT_ERR_MSG_WITH_ERRNO(
-                                               "Failed to defrag");
+                                       "Failed to defrag with "
+                                       "EXT4_IOC_MOVE_EXT ioctl");
+                               if (errno == ENOTTY)
+                                       printf("\tAt least 2.6.31-rc1 of "
+                                               "vanilla kernel is required\n");
                        } else {
                                printf("\t[ NG ]\n");
                        }