btrfs-progs: lowmem: move nbytes check before isize check
For files, lowmem repair will try to check nbytes and isize, but isize check depends nbytes. Once bytes has been repaired, then isize should be checked and repaired. So move nbytes check before isize check. Also set nbytes to extent_size once repaired successfully. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com>
This commit is contained in:
parent
ee455db07e
commit
0ea38ae08d
|
@ -2606,6 +2606,22 @@ out:
|
|||
}
|
||||
}
|
||||
|
||||
if (nbytes != extent_size) {
|
||||
if (repair) {
|
||||
ret = repair_inode_nbytes_lowmem(root, path,
|
||||
inode_id, extent_size);
|
||||
if (!ret)
|
||||
nbytes = extent_size;
|
||||
}
|
||||
if (!repair || ret) {
|
||||
err |= NBYTES_ERROR;
|
||||
error(
|
||||
"root %llu INODE[%llu] nbytes %llu not equal to extent_size %llu",
|
||||
root->objectid, inode_id, nbytes,
|
||||
extent_size);
|
||||
}
|
||||
}
|
||||
|
||||
if (!nbytes && !no_holes && extent_end < isize) {
|
||||
if (repair)
|
||||
ret = punch_extent_hole(root, path, inode_id,
|
||||
|
@ -2617,19 +2633,6 @@ out:
|
|||
root->objectid, inode_id, isize);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbytes != extent_size) {
|
||||
if (repair)
|
||||
ret = repair_inode_nbytes_lowmem(root, path,
|
||||
inode_id, extent_size);
|
||||
if (!repair || ret) {
|
||||
err |= NBYTES_ERROR;
|
||||
error(
|
||||
"root %llu INODE[%llu] nbytes %llu not equal to extent_size %llu",
|
||||
root->objectid, inode_id, nbytes,
|
||||
extent_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (err & LAST_ITEM)
|
||||
|
|
Loading…
Reference in New Issue