Message ID | 20180912204924.10089-4-suy.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: lowmem: bug fixes and inode_extref repair | expand |
On 2018/9/13 上午4:49, damenly.su@gmail.com wrote: > From: Su Yue <suy.fnst@cn.fujitsu.com> > > In check_dir_item, we are going to search corresponding > dir_item/index. > > Commit 564901eac7a4 ("btrfs-progs: check: introduce > print_dir_item_err()") Changed argument name from key to di_key but > forgot to change the key name for dir_item search. > So @key shouldn't be used here. It should be @di_key. > > Fixes: 564901eac7a4 ("btrfs-progs: check: introduce print_dir_item_err()") Which also forgot to modify comment about parameters. > Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> > --- > check/mode-lowmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c > index 1bce44f5658a..89a304bbdd69 100644 > --- a/check/mode-lowmem.c > +++ b/check/mode-lowmem.c > @@ -1658,7 +1658,7 @@ begin: > > /* check relative INDEX/ITEM */ > key.objectid = di_key->objectid; > - if (key.type == BTRFS_DIR_ITEM_KEY) { > + if (di_key->type == BTRFS_DIR_ITEM_KEY) { To avoid such problem, I recommend to rename @key to @search_key, and move the declaration inside the while loop. Thanks, Qu > key.type = BTRFS_DIR_INDEX_KEY; > key.offset = index; > } else { >
On 09/14/2018 07:33 AM, Qu Wenruo wrote: > > > On 2018/9/13 上午4:49, damenly.su@gmail.com wrote: >> From: Su Yue <suy.fnst@cn.fujitsu.com> >> >> In check_dir_item, we are going to search corresponding >> dir_item/index. >> >> Commit 564901eac7a4 ("btrfs-progs: check: introduce >> print_dir_item_err()") Changed argument name from key to di_key but >> forgot to change the key name for dir_item search. >> So @key shouldn't be used here. It should be @di_key. >> >> Fixes: 564901eac7a4 ("btrfs-progs: check: introduce print_dir_item_err()") > > Which also forgot to modify comment about parameters. Oh....Noticed > >> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> >> --- >> check/mode-lowmem.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c >> index 1bce44f5658a..89a304bbdd69 100644 >> --- a/check/mode-lowmem.c >> +++ b/check/mode-lowmem.c >> @@ -1658,7 +1658,7 @@ begin: >> >> /* check relative INDEX/ITEM */ >> key.objectid = di_key->objectid; >> - if (key.type == BTRFS_DIR_ITEM_KEY) { >> + if (di_key->type == BTRFS_DIR_ITEM_KEY) { > > To avoid such problem, I recommend to rename @key to @search_key, and > move the declaration inside the while loop. > Nice suggestion. Will do it in next version. Thanks, Su > Thanks, > Qu > >> key.type = BTRFS_DIR_INDEX_KEY; >> key.offset = index; >> } else { >> > >
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 1bce44f5658a..89a304bbdd69 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -1658,7 +1658,7 @@ begin: /* check relative INDEX/ITEM */ key.objectid = di_key->objectid; - if (key.type == BTRFS_DIR_ITEM_KEY) { + if (di_key->type == BTRFS_DIR_ITEM_KEY) { key.type = BTRFS_DIR_INDEX_KEY; key.offset = index; } else {