[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140819043858.GN2808@birch.djwong.org>
Date: Mon, 18 Aug 2014 21:38:58 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: Jun He <jhe@...wisc.edu>
Cc: linux-ext4 <linux-ext4@...r.kernel.org>
Subject: Re: e2fsprogs: debugfs: set_inode_field fails to set block[IND]...
On Mon, Aug 18, 2014 at 11:32:10PM -0500, Jun He wrote:
> Hi,
> I hope this is the right place to report problems of e2fsprogs.
>
> When trying to update block[IND], block[DIND], and block[TIND], it
> gives the similar error message:
>
> jhe@...e001:~$ sudo debugfs /dev/loop0 -w -R 'set_inode_field
> firstfile block[IND] 2'
> debugfs 1.42 (29-Nov-2011)
> set_inode_field: invalid field specifier: block[IND]
>
> I looked at the code and found the problem in the following code in
> find_field() in debugfs/set_fields.c.
>
> idx = strchr(arg, '[');
> if (idx) {
> *idx++ = 0;
> delim = idx + strlen(idx) - 1;
> if (!*idx || *delim != ']')
> idx = 0;
> else
> *delim = 0;
> }
> /*
> * Can we parse the number?
> */
> if (idx) {
> array_idx = strtol(idx, &tmp, 0);
> if (*tmp)
> idx = 0;
> }
>
>
> When the field name is something like "block[4]", this works. It sets
> '[' and ']' to 0 and converts the number between them.
> When the field name is block[IND], it still replaces '[' and ']' with
> 0. So arg becomes 'block' and will always fail the following test of
> if (strcmp(ss->name, arg) != 0).
>
> One possible fix is to change the max limit for field 'block', use
> number to index IND, DIND, and TIND.
> Or, name 'block[IND]', 'block[DIND]', and 'block[TIND]' differently
> without the '[' ']'. Such as 'block.IND', 'block.DIND', 'block.TIND'.
>
> If it's just a usage problem, please let me know how to use
> set_inode_field to set block[IND].. correctly.
Seems pretty broken to me. I'll review any patch you send. :)
FWIW, I've been using modify_inode to mess with those fields.
Not that either command does much good for an extent files.
--D
>
> Thanks,
> Jun
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists