Skip to contentSkip to conversation

e4defrag: return more specific error message on ioctl failure

PATCH In review Peng Tao 2 participants 4 messages Jul 19, 2009 – Jul 20, 2009

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

PATCH 1/5 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.

---
 misc/e4defrag.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
misc/e4defrag.c +5 -1
index c25514a..f1c3008 100644
@@ -1553,7 +1553,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"
+						" vallina kernel is required\n");
 			} else {
 				printf("\t[ NG ]\n");
 			}
Signature · 1 line
1.6.2.GIT
author
#1 lore raw

oops, please ignore the [patch 1/5] series number. It was miss typed.

Quoted 33 lines · Peng Tao

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.

---
 misc/e4defrag.c |    6 +++++-

 1 files changed, 5 insertions(+), 1 deletions(-)
misc/e4defrag.c +0 -0
index c25514a..f1c3008 100644
@@ -1553,7 +1553,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"
+                                               " vallina kernel is required\n"); } else {
                               printf("\t[ NG ]\n");
                       }
--
1.6.2.GIT

Signature · 4 lines
Cheers,
Peng Tao
State Key Laboratory of Networking and Switching Technology
Beijing Univ. of Posts and Telecoms.
#2 lore raw
In reply to Peng Tao
Quoted 17 lines · Peng Tao

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.

---
 misc/e4defrag.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
misc/e4defrag.c +0 -0
index c25514a..f1c3008 100644

misc/e4defrag.c static int call_defrag(int fd, int donor_fd, const char *file, · line 1560

Quoted 9 lines
misc/e4defrag.c +5 -1
@@ -1553,7 +1553,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"
+						" vallina kernel is required\n");

Typo here, s/b "vanilla"

-Eric

Quoted 3 lines
misc/e4defrag.c +0 -0
 			} else {
 				printf("\t[ NG ]\n");
 			}
author
#3 lore raw
Quoted 30 lines · Eric Sandeen
Quoted 17 lines · Peng Tao

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.

---
 misc/e4defrag.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
misc/e4defrag.c +0 -0
index c25514a..f1c3008 100644

misc/e4defrag.c static int call_defrag(int fd, int donor_fd, const char *file, · line 1560

Quoted 9 lines
misc/e4defrag.c +5 -1
@@ -1553,7 +1553,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"
+						" vallina kernel is required\n");

Typo here, s/b "vanilla"

Quoted 1 line

-Eric

Hi, Eric
Thank your for your reviewing. Revised the patch:

Quoted 1 line

From d56fcfae01c3b0c4963c0ec75ffa654e70086a57 Mon Sep 17 00:00:00 2001

From: Peng Tao <[email protected]>
Date: Mon, 20 Jul 2009 12:11:01 +0800
Subject: [PATCH] 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.

---
 misc/e4defrag.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
misc/e4defrag.c +5 -1
index c25514a..eff6ed9 100644
@@ -1553,7 +1553,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");
 			}
Signature · 4 lines
Best Regards,
Peng Tao
State Key Laboratory of Networking and Switching Technology
Beijing Univ. of Posts and Telecoms.