[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e2a5550d-fb55-99c1-82b1-5b6c174f7cfc@huaweicloud.com>
Date: Tue, 12 Aug 2025 17:34:57 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Christoph Hellwig <hch@...radead.org>, Damien Le Moal <dlemoal@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>, Rajeev Mishra <rajeevm@....com>,
axboe@...nel.dk, yukuai1@...weicloud.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH v2] loop: use vfs_getattr_nosec() for accurate file size
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
>
>
> .
>
Powered by blists - more mailing lists