From: Peng Tao Date: Mon, 13 Dec 2010 14:44:57 +0000 (-0500) Subject: e4defrag: return more specific error message on ioctl failure X-Git-Tag: v1.42-WIP-0702~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae09b934a7e8035edb9f91dd8d39726daa9048f0;p=thirdparty%2Fe2fsprogs.git e4defrag: return more specific error message on ioctl failure 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 Signed-off-by: Theodore Ts'o --- diff --git a/misc/e4defrag.c b/misc/e4defrag.c index 8b0894f7a..5b72cfaca 100644 --- a/misc/e4defrag.c +++ b/misc/e4defrag.c @@ -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"); }