mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-15 08:14:21 +08:00
btrfs-progs: check/lowmem: Skip nbytes check for orphan inodes
For orphan inodes, kernel won't update its nbytes and size since it's a waste of time. So lowmem check can report false alert on some orphan inodes. Fix it by checking if the inode is an orphan before complaining/repairing its nbytes. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
9b1a1dacbc
commit
c31bd8db54
@ -2519,6 +2519,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
|
||||
return err;
|
||||
}
|
||||
|
||||
is_orphan = has_orphan_item(root, inode_id);
|
||||
ii = btrfs_item_ptr(node, slot, struct btrfs_inode_item);
|
||||
isize = btrfs_inode_size(node, ii);
|
||||
nbytes = btrfs_inode_nbytes(node, ii);
|
||||
@ -2672,19 +2673,22 @@ out:
|
||||
"root %llu INODE[%llu] nlink(%llu) not equal to inode_refs(%llu)",
|
||||
root->objectid, inode_id, nlink, refs);
|
||||
}
|
||||
} else if (!nlink) {
|
||||
is_orphan = has_orphan_item(root, inode_id);
|
||||
if (!is_orphan && repair)
|
||||
} else if (!nlink && !is_orphan) {
|
||||
if (repair)
|
||||
ret = repair_inode_orphan_item_lowmem(root,
|
||||
path, inode_id);
|
||||
if (!is_orphan && (!repair || ret)) {
|
||||
if (!repair || ret) {
|
||||
err |= ORPHAN_ITEM;
|
||||
error("root %llu INODE[%llu] is orphan item",
|
||||
root->objectid, inode_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbytes != extent_size) {
|
||||
/*
|
||||
* For orhpan inode, updating nbytes/size is just a waste of
|
||||
* time, so skip such repair and don't report them as error.
|
||||
*/
|
||||
if (nbytes != extent_size && !is_orphan) {
|
||||
if (repair) {
|
||||
ret = repair_inode_nbytes_lowmem(root, path,
|
||||
inode_id, extent_size);
|
||||
|
Loading…
Reference in New Issue
Block a user