Message ID | 20200915053532.63279-8-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: add read-only support for subpage sector size | expand |
On 15/09/2020 07:36, Qu Wenruo wrote: > + * For sectorsize < PAGE_SIZE case, we only want to support 64K > + * PAGE_SIZE, and ensured all tree blocks won't cross page boundary. > + * So in that case we always got 1 page. Just to clarify, does this mean we won't support 512B sector size with 4K pages?
On 2020/9/15 下午4:42, Johannes Thumshirn wrote: > On 15/09/2020 07:36, Qu Wenruo wrote: >> + * For sectorsize < PAGE_SIZE case, we only want to support 64K >> + * PAGE_SIZE, and ensured all tree blocks won't cross page boundary. >> + * So in that case we always got 1 page. > > Just to clarify, does this mean we won't support 512B sector size with 4K pages? > At least that's why I have planned. I think the current minimal 4K sector size is pretty reasonable. Thanks, Qu
On 2020/9/15 下午4:42, Johannes Thumshirn wrote: > On 15/09/2020 07:36, Qu Wenruo wrote: >> + * For sectorsize < PAGE_SIZE case, we only want to support 64K >> + * PAGE_SIZE, and ensured all tree blocks won't cross page boundary. >> + * So in that case we always got 1 page. > > Just to clarify, does this mean we won't support 512B sector size with 4K pages? > At least I don't plan to support sector size smaller than 4K. Thanks, Qu
On 15/09/2020 12:07, Qu Wenruo wrote: > > > On 2020/9/15 下午4:42, Johannes Thumshirn wrote: >> On 15/09/2020 07:36, Qu Wenruo wrote: >>> + * For sectorsize < PAGE_SIZE case, we only want to support 64K >>> + * PAGE_SIZE, and ensured all tree blocks won't cross page boundary. >>> + * So in that case we always got 1 page. >> >> Just to clarify, does this mean we won't support 512B sector size with 4K pages? >> > At least that's why I have planned. > > I think the current minimal 4K sector size is pretty reasonable. OK thanks
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index d511890702cc..61556d6e9363 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -229,8 +229,15 @@ void wait_on_extent_buffer_writeback(struct extent_buffer *eb); static inline int num_extent_pages(const struct extent_buffer *eb) { - return (round_up(eb->start + eb->len, PAGE_SIZE) >> PAGE_SHIFT) - - (eb->start >> PAGE_SHIFT); + /* + * For sectorsize == PAGE_SIZE case, since eb is always aligned to + * sectorsize, it's just (eb->len / PAGE_SIZE) >> PAGE_SHIFT. + * + * For sectorsize < PAGE_SIZE case, we only want to support 64K + * PAGE_SIZE, and ensured all tree blocks won't cross page boundary. + * So in that case we always got 1 page. + */ + return (round_up(eb->len, PAGE_SIZE) >> PAGE_SHIFT); } static inline int extent_buffer_uptodate(const struct extent_buffer *eb)
For subpage sized extent buffer, we have ensured no extent buffer will cross page boundary, thus we would only need one page for any extent buffer. This patch will update the function num_extent_pages() to handle such case. Now num_extent_pages() would return 1 instead of for subpage sized extent buffer. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/extent_io.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)