diff mbox

[1/5] e4defrag: return more specific error message on ioctl failure

Message ID 1248025668-25901-1-git-send-email-bergwolf@gmail.com
State Superseded, archived
Headers show

Commit Message

Peng Tao July 19, 2009, 5:47 p.m. UTC
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>
---
 misc/e4defrag.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Comments

Peng Tao July 19, 2009, 6 p.m. UTC | #1
b29wcywgcGxlYXNlIGlnbm9yZSB0aGUgW3BhdGNoIDEvNV0gc2VyaWVzIG51bWJlci4gSXQgd2Fz
IG1pc3MgdHlwZWQuCgpPbiBNb24sIEp1bCAyMCwgMjAwOSBhdCAxOjQ3IEFNLCBQZW5nIFRhbzxi
ZXJnd29sZkBnbWFpbC5jb20+IHdyb3RlOgo+IEN1cnJlbnRseSBlNGRlZnJhZyByZWxpZXMgb24g
dGhlIEVYVDRfSU9DX01PVkVfRVhUIGlvY3RsIHRvIHBlcmZvcm0gb25saW5lCj4gZGVmcmFnbWVu
dGF0aW9uLiBIb3dldmVyLCB0aGlzIGlvdGNsIGtlcm5lbCBwYXRjaCBpcyBub3QgYXZhaWxhYmxl
IGJlZm9yZQo+IDIuNi4zMC1yYzEuIGU0ZGVmcmFnIHNoYWxsIGZhaWwgd2l0aG91dCBvYnZpb3Vz
IHJlYXNvbnMgb24gc3lzdGVtcyBydW5uaW5nCj4gb2xkZXIga2VybmVscy4gVGhlIHBhdGNoIGFk
ZHMgbW9yZSBkZXRhaWxlZCBlcnJvciBtZXNzYWdlIGFkZHJlc3NpbmcgdGhpcwo+IGlzc3VlIGFu
ZCBwcm9tcHRzIHVzZXJzIHdpdGggdGhlIG1pbmltYWwga2VybmVsIHZlcnNpb24gdG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yYWcgd2l0aCAiCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAiRVhUNF9JT0NfTU9WRV9FWFQgaW9jdGwi
KTsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChl
cnJubyA9PSBFTk9UVFkpCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCBwcmludGYoIlx0QXQgbGVhc3QgMi42LjMxLXJjMSBvZiIKPiAr
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgICIgdmFsbGluYSBrZXJuZWwgaXMgcmVxdWlyZWRcbiIpOwo+IMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfSBlbHNlIHsKPiDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoHByaW50ZigiXHRbIE5HIF1cbiIpOwo+IMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfQo+IC0tCj4gMS42LjIuR0lUCj4KPgoKCgot
LSAKQ2hlZXJzLApQZW5nIFRhbwpTdGF0ZSBLZXkgTGFib3JhdG9yeSBvZiBOZXR3b3JraW5nIGFu
ZCBTd2l0Y2hpbmcgVGVjaG5vbG9neQpCZWlqaW5nIFVuaXYuIG9mIFBvc3RzIGFuZCBUZWxlY29t
cy4K
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen July 19, 2009, 9:36 p.m. UTC | #2
Peng Tao wrote:
> 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>
> ---
>  misc/e4defrag.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/misc/e4defrag.c b/misc/e4defrag.c
> index c25514a..f1c3008 100644
> --- a/misc/e4defrag.c
> +++ b/misc/e4defrag.c
> @@ -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

>  			} else {
>  				printf("\t[ NG ]\n");
>  			}

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index c25514a..f1c3008 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -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");
 			}