[PATCH v2] erofs-utils: introduce the I/O manager
Hongzhen Luo
hongzhen at linux.alibaba.com
Wed Jun 5 13:54:38 AEST 2024
On 2024/6/5 11:52, Gao Xiang wrote:
> (+ Cc linux-erofs)
>
> On 2024/6/5 11:32, Hongzhen Luo wrote:
>>
>> 在 2024/6/5 10:55, Gao Xiang 写道:
>>>
>>>
>>> On 2024/6/4 20:10, Hongzhen Luo wrote:
>>>> Introduce the I/O manager to provide a more flexible way to specify
>>>> the virtual storage.
>>>>
>>>> Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
>>>> ---
>>>> v2: Updated the handling of `.dev_close` being unimplemented in
>>>> `erofs_dev_close` and so on.
>>>> v1:
>>>> https://lore.kernel.org/all/20240604093556.3883585-1-hongzhen@linux.alibaba.com/
>>>
>>> I'm unable to apply this patch.
>>>
>> Sorry about that, I overlooked developing based on the latest branch.
>> I will send a v3 soon.
>>>> ---
>>>
>>> ...
>>>
>>>> +struct erofs_io_manager {
>>>> + int (*dev_open)(struct erofs_sb_info *sbi, const char *devname);
>>>
>>> int (*open)(...);
>>>
>>>> + int (*dev_open_ro)(struct erofs_sb_info *sbi, const char *dev);
>>>
>>> int (*open_ro)(...);
>>>
>>>> + int (*blob_open_ro)(struct erofs_sb_info *sbi, const char *dev);
>>>
>>>
>>> int (*blob_open_ro)(...);
>>>
>>>> + int (*dev_read)(struct erofs_sb_info *sbi, int device_id,
>>>> + void *buf, u64 offset, size_t len);
>>>
>>> int (*read)(...);
>>>
>>>> + int (*dev_write)(struct erofs_sb_info *sbi, const void *buf,
>>>> + u64 offset, size_t len);
>>>
>>> int (*write)(...);
>>>
>>>> + int (*dev_fillzero)(struct erofs_sb_info *sbi, u64 offset,
>>>> + size_t len, bool padding);
>>> int (*fillzero)(...);
>>>
>>>> + int (*dev_fsync)(struct erofs_sb_info *sbi);
>>>
>>> int (*fsync)(...);
>>>
>>>> + int (*dev_resize)(struct erofs_sb_info *sbi, erofs_blk_t
>>>> nblocks);
>>>
>>> int (*resize)(...);
>>>
>>>> + void (*dev_close)(struct erofs_sb_info *sbi);
>>>
>>> int (*close)(...);
>>>
>>>> + void (*blob_closeall)(struct erofs_sb_info *sbi);
>>>
>>> int (*blob_closeall)(...);
>>>
>>>> + void *private_data;
>>>
>>> What does this mean?
>>>
>> Interface implementers can use it to store the data they wish to
>> save. For example, in C++, this pointer can be used to store an
>> object pointer, thereby accessing the data associated with the object.
>>
>> Another option is to remove this pointer and let the implementer wrap
>> the I/O manager into another object. Which strategy to adopt needs to
>> be discussed.
>
> I don't see how private_data is used in this patch and it's
> unrelated to C++. If it's unused, please remove it entirely.
>
> Thanks,
> Gao Xiang
---
Ok, I will send a v3 soon.
Thanks,
Hongzhen Luo
More information about the Linux-erofs
mailing list