mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
ext4: support large block size in mpage_prepare_extent_to_map()
Use the EXT4_PG_TO_LBLK/EXT4_LBLK_TO_PG macros to complete the conversion between folio indexes and blocks to avoid negative left/right shifts after supporting blocksize greater than PAGE_SIZE. Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Message-ID: <20251121090654.631996-20-libaokun@huaweicloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
@@ -2620,7 +2620,6 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
|
||||
pgoff_t end = mpd->end_pos >> PAGE_SHIFT;
|
||||
xa_mark_t tag;
|
||||
int i, err = 0;
|
||||
int blkbits = mpd->inode->i_blkbits;
|
||||
ext4_lblk_t lblk;
|
||||
struct buffer_head *head;
|
||||
handle_t *handle = NULL;
|
||||
@@ -2659,7 +2658,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
|
||||
*/
|
||||
if (mpd->wbc->sync_mode == WB_SYNC_NONE &&
|
||||
mpd->wbc->nr_to_write <=
|
||||
mpd->map.m_len >> (PAGE_SHIFT - blkbits))
|
||||
EXT4_LBLK_TO_PG(mpd->inode, mpd->map.m_len))
|
||||
goto out;
|
||||
|
||||
/* If we can't merge this page, we are done. */
|
||||
@@ -2737,8 +2736,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
|
||||
mpage_folio_done(mpd, folio);
|
||||
} else {
|
||||
/* Add all dirty buffers to mpd */
|
||||
lblk = ((ext4_lblk_t)folio->index) <<
|
||||
(PAGE_SHIFT - blkbits);
|
||||
lblk = EXT4_PG_TO_LBLK(mpd->inode, folio->index);
|
||||
head = folio_buffers(folio);
|
||||
err = mpage_process_page_bufs(mpd, head, head,
|
||||
lblk);
|
||||
|
||||
Reference in New Issue
Block a user