Re: [PATCH v8 06/19] block, fs: Propagate write hints to the block device inode

Bart Van Assche
2024-01-23T15:29:11Z

On 1/23/24 04:16, Kanchan Joshi wrote:
> On 1/23/2024 1:39 AM, Bart Van Assche wrote:
>> On 1/22/24 01:31, Kanchan Joshi wrote:
>>> On 1/19/2024 7:26 PM, Kanchan Joshi wrote:
>>>> On 1/19/2024 12:24 AM, Bart Van Assche wrote:
>>>>> I think the above proposal would introduce a bug: it would break the
>>>>> F_GET_RW_HINT implementation.
>>>>
>>>> Right. I expected to keep the exact change in GET, too, but that will
>>>> not be free from the side-effect.
>>>> The buffered-write path (block_write_full_page) picks the hint from one
>>>> inode, and the direct-write path (__blkdev_direct_IO_simple) picks the
>>>> hint from a different inode.
>>>> So, updating both seems needed here.
>>>
>>> I stand corrected. It's possible to do away with two updates.
>>> The direct-io code (patch 8) should rather be changed to pick the hint
>>> from bdev inode (and not from file inode).
>>> With that change, this patch only need to set the hint into only one
>>> inode (bdev one). What do you think?
>>
>> I think that would break direct I/O submitted by a filesystem.
>
> By breakage do you mean not being able to set/get the hint correctly?
> I tested with XFS and Ext4 direct I/O. No breakage.

The approach that you proposed is wrong from a conceptual point of view.
Zero, one or more block devices can be associated with a filesystem. It
would be wrong to try to access all associated block devices from inside
the F_SET_RW_HINT implementation. I don't think that there is any API in
the Linux kernel for iterating over all the block devices associated with
a filesystem.

Bart.