Re: [RFC 0/4] convert create_page_buffers to create_folio_buffers
From: Pankaj Raghav
Date: Fri Apr 14 2023 - 11:00:48 EST
>> Pankaj Raghav (4):
>> fs/buffer: add set_bh_folio helper
>> buffer: add alloc_folio_buffers() helper
>> fs/buffer: add folio_create_empty_buffers helper
>> fs/buffer: convert create_page_buffers to create_folio_buffers
>>
>> fs/buffer.c | 131 +++++++++++++++++++++++++++++++++---
>> include/linux/buffer_head.h | 4 ++
>> 2 files changed, 125 insertions(+), 10 deletions(-)
>>
> Funnily enough, I've been tinkering along the same lines, and ended up with pretty similar patches.
> I've had to use two additional patches to get my modified 'brd' driver off the ground with logical
> blocksize of 16k:
Good to know that we are working on a similar direction here.
> - mm/filemap: allocate folios according to the blocksize
> (will be sending the patch separately)
> - Modify read_folio() to use the correct order:
>
> @@ -2333,13 +2395,15 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
> if (IS_ENABLED(CONFIG_FS_VERITY) && IS_VERITY(inode))
> limit = inode->i_sb->s_maxbytes;
>
> - VM_BUG_ON_FOLIO(folio_test_large(folio), folio);
> -
> head = create_folio_buffers(folio, inode, 0);
> blocksize = head->b_size;
> bbits = block_size_bits(blocksize);
>
> - iblock = (sector_t)folio->index << (PAGE_SHIFT - bbits);
> + if (WARN_ON(PAGE_SHIFT < bbits)) {
> + iblock = (sector_t)folio->index >> (bbits - PAGE_SHIFT);
> + } else {
> + iblock = (sector_t)folio->index << (PAGE_SHIFT - bbits);
> + }
> lblock = (limit+blocksize-1) >> bbits;
> bh = head;
> nr = 0;
>
>
> With that (and my modified brd driver) I've been able to set the logical blocksize to 16k for brd
> and have it happily loaded.
I will give your patches a try as well.