Hi,
在 2025/08/12 16:37, Christoph Hellwig 写道:
On Tue, Aug 12, 2025 at 02:17:01PM +0900, Damien Le Moal wrote:
And indeed, that:
/* size of the new backing store needs to be the same */
if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
goto out_err;
Will need some massaging.
Why? get_loop_size just derives the first arguments to get_size
from the passed in loop device in the same way the only other caller
to get_size does. So we can just:
1) convert loop_set_status to use get_loop_size
2) Fold get_size into get_loop_size
3) Maye rename get_size to lo_calculate_size to have a descriptive
name while we're touching it?
4) switch to vfs_getattr
This looks good, it's better to refactor a bit before switch to getattr,
and I agree still return 0 on failue is fine.
Thanks,
Kuai
.