FAILED: patch "[PATCH] f2fs: fix wrong block mapping for multi-devices" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 9d5c4f5c7a2c7677e1b3942772122b032c265aae
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025102052-work-collected-f03f@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9d5c4f5c7a2c7677e1b3942772122b032c265aae Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <[email protected]>
Date: Tue, 7 Oct 2025 03:32:30 +0000
Subject: [PATCH] f2fs: fix wrong block mapping for multi-devices
Assuming the disk layout as below,
disk0: 0 --- 0x00035abfff
disk1: 0x00035ac000 --- 0x00037abfff
disk2: 0x00037ac000 --- 0x00037ebfff
and we want to read data from offset=13568 having len=128 across the block devices, we can illustrate the block addresses like below.
0 .. 0x00037ac000 ------------------- 0x00037ebfff, 0x00037ec000 -------
| ^ ^ ^
| fofs 0 13568 13568+128
| ------------------------------------------------------
| LBA 0x37e8aa9 0x37ebfa9 0x37ec029
--- map 0x3caa9 0x3ffa9In this example, we should give the relative map of the target block device ranging from 0x3caa9 to 0x3ffa9 where the length should be calculated by 0x37ebfff + 1 - 0x37ebfa9.
In the below equation, however, map->m_pblk was supposed to be the original address instead of the one from the target block address.
- map->m_len = min(map->m_len, dev->end_blk + 1 - map->m_pblk);
fs/f2fs/data.c +1 -1
@@ -1497,8 +1497,8 @@ static bool f2fs_map_blocks_cached(struct inode *inode,struct f2fs_dev_info *dev = &sbi->devs[bidx]; map->m_bdev = dev->bdev; - map->m_pblk -= dev->start_blk; map->m_len =min (map->m_len, dev->end_blk +1 - map->m_pblk); + map->m_pblk -= dev->start_blk; }else { map->m_bdev = inode->i_sb->s_bdev; }
Sasha Levin
maintainerPATCH 1/4 f2fs: add a f2fs_get_block_locked helper
From: Christoph Hellwig <[email protected]>
[ Upstream commit cf342d3beda000b4c60990755ca7800de5038785 ]
This allows to keep the f2fs_do_map_lock based locking scheme private to data.c.
Stable-dep-of: 9d5c4f5c7a2c ("f2fs: fix wrong block mapping for multi-devices")
--- fs/f2fs/data.c | 16 ++++++++++++++-- fs/f2fs/f2fs.h | 3 +-- fs/f2fs/file.c | 4 +--- 3 files changed, 16 insertions(+), 7 deletions(-)
fs/f2fs/data.c +14 -2
@@ -1192,7 +1192,7 @@ int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index)return err; } -int f2fs_get_block (struct dnode_of_data *dn,pgoff_t index) +static int f2fs_get_block (struct dnode_of_data *dn,pgoff_t index) {struct extent_info ei = {0 , };struct inode *inode = dn->inode;
@@ -1432,7 +1432,7 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type)return 0 ; } -void f2fs_do_map_lock (struct f2fs_sb_info *sbi,int flag,bool lock) +static void f2fs_do_map_lock (struct f2fs_sb_info *sbi,int flag,bool lock) {if (flag ==F2FS_GET_BLOCK_PRE_AIO ) {if (lock)
@@ -1447,6 +1447,18 @@ void f2fs_do_map_lock(struct f2fs_sb_info *sbi, int flag, bool lock) } } +int f2fs_get_block_locked (struct dnode_of_data *dn,pgoff_t index) +{ +struct f2fs_sb_info *sbi =F2FS_I_SB (dn->inode); +int err; + +f2fs_do_map_lock (sbi,F2FS_GET_BLOCK_PRE_AIO , true); + err =f2fs_get_block (dn, index); +f2fs_do_map_lock (sbi,F2FS_GET_BLOCK_PRE_AIO , false); + +return err; +} +/* * f2fs_map_blocks() tries to find or build mapping relationship which * maps continuous logical blocks to physical blocks, and return such
fs/f2fs/f2fs.h +1 -2
@@ -3783,7 +3783,7 @@ void f2fs_set_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr);void f2fs_update_data_blkaddr (struct dnode_of_data *dn,block_t blkaddr);int f2fs_reserve_new_blocks (struct dnode_of_data *dn,blkcnt_t count);int f2fs_reserve_new_block (struct dnode_of_data *dn); -int f2fs_get_block (struct dnode_of_data *dn,pgoff_t index); +int f2fs_get_block_locked (struct dnode_of_data *dn,pgoff_t index);int f2fs_reserve_block (struct dnode_of_data *dn,pgoff_t index);struct page *f2fs_get_read_data_page (struct inode *inode,pgoff_t index,blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs);
@@ -3794,7 +3794,6 @@ struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,struct page *f2fs_get_new_data_page (struct inode *inode,struct page *ipage,pgoff_t index,bool new_i_size);int f2fs_do_write_data_page (struct f2fs_io_info *fio); -void f2fs_do_map_lock (struct f2fs_sb_info *sbi,int flag,bool lock);int f2fs_map_blocks (struct inode *inode,struct f2fs_map_blocks *map,int create,int flag); int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
fs/f2fs/file.c +1 -3
@@ -113,10 +113,8 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)if (need_alloc) {/* block allocation */ -f2fs_do_map_lock (sbi,F2FS_GET_BLOCK_PRE_AIO , true);set_new_dnode (&dn, inode,NULL ,NULL ,0 ); - err =f2fs_get_block (&dn, page->index); -f2fs_do_map_lock (sbi,F2FS_GET_BLOCK_PRE_AIO , false); + err =f2fs_get_block_locked (&dn, page->index); }#ifdef CONFIG_F2FS_FS_COMPRESSION
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 2/4 f2fs: remove the create argument to f2fs_map_blocks
From: Christoph Hellwig <[email protected]>
[ Upstream commit cd8fc5226bef3a1fda13a0e61794a039ca46744a ]
The create argument is always identicaly to map->m_may_create, so use that consistently.
Stable-dep-of: 9d5c4f5c7a2c ("f2fs: fix wrong block mapping for multi-devices")
--- fs/f2fs/data.c | 63 ++++++++++++++++--------------------- fs/f2fs/f2fs.h | 3 +- fs/f2fs/file.c | 12 +++---- include/trace/events/f2fs.h | 11 +++---- 4 files changed, 38 insertions(+), 51 deletions(-)
fs/f2fs/data.c +27 -36
@@ -1464,8 +1464,7 @@ int f2fs_get_block_locked(struct dnode_of_data *dn, pgoff_t index)* maps continuous logical blocks to physical blocks, and return such * info via f2fs_map_blocks structure. */ -int f2fs_map_blocks (struct inode *inode,struct f2fs_map_blocks *map, -int create,int flag) +int f2fs_map_blocks (struct inode *inode,struct f2fs_map_blocks *map,int flag) {unsigned int maxblocks = map->m_len;struct dnode_of_data dn;
@@ -1494,38 +1493,31 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, pgofs = (pgoff_t )map->m_lblk; end = pgofs + maxblocks; -if (!create &&f2fs_lookup_read_extent_cache (inode, pgofs, &ei)) { -if (f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && - map->m_may_create) - goto next_dnode; +if (map->m_may_create || + !f2fs_lookup_read_extent_cache (inode, pgofs, &ei)) + goto next_dnode; - map->m_pblk = ei.blk + pgofs - ei.fofs; - map->m_len =min ((pgoff_t )maxblocks, ei.fofs + ei.len - pgofs); - map->m_flags =F2FS_MAP_MAPPED ; -if (map->m_next_extent) - *map->m_next_extent = pgofs + map->m_len; +/* Found the map in read extent cache */ + map->m_pblk = ei.blk + pgofs - ei.fofs; + map->m_len =min ((pgoff_t )maxblocks, ei.fofs + ei.len - pgofs); + map->m_flags =F2FS_MAP_MAPPED ; +if (map->m_next_extent) + *map->m_next_extent = pgofs + map->m_len; -/* for hardware encryption, but to avoid potential issue in future */ -if (flag ==F2FS_GET_BLOCK_DIO ) -f2fs_wait_on_block_writeback_range (inode, +/* for hardware encryption, but to avoid potential issue in future */ +if (flag ==F2FS_GET_BLOCK_DIO ) +f2fs_wait_on_block_writeback_range (inode, map->m_pblk, map->m_len); -if (map->m_multidev_dio) { -block_t blk_addr = map->m_pblk; - - bidx =f2fs_target_device_index (sbi, map->m_pblk); +if (map->m_multidev_dio) { + bidx =f2fs_target_device_index (sbi, map->m_pblk); - map->m_bdev =FDEV (bidx).bdev; - map->m_pblk -=FDEV (bidx).start_blk; - map->m_len =min (map->m_len, + map->m_bdev =FDEV (bidx).bdev; + map->m_pblk -=FDEV (bidx).start_blk; + map->m_len =min (map->m_len,FDEV (bidx).end_blk +1 - map->m_pblk); - -if (map->m_may_create) -f2fs_update_device_state (sbi, inode->i_ino, - blk_addr, map->m_len); - } - goto out; } + goto out; next_dnode:if (map->m_may_create)
@@ -1589,7 +1581,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,set_inode_flag (inode,FI_APPEND_WRITE ); } }else { -if (create) { +if (map->m_may_create) {if (unlikely (f2fs_cp_error (sbi))) { err = -EIO ; goto sync_out;
@@ -1764,7 +1756,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,f2fs_balance_fs (sbi, dn.node_changed); } out: -trace_f2fs_map_blocks (inode, map, create, flag, err); +trace_f2fs_map_blocks (inode, map, flag, err);return err; }
@@ -1786,7 +1778,7 @@ bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len)while (map.m_lblk < last_lblk) { map.m_len = last_lblk - map.m_lblk; - err =f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_DEFAULT ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_DEFAULT );if (err || map.m_len ==0 )return false; map.m_lblk += map.m_len;
@@ -1960,7 +1952,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, map.m_len = cluster_size - count_in_cluster; } - ret =f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_FIEMAP ); + ret =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_FIEMAP );if (ret) goto out;
@@ -2093,7 +2085,7 @@ static int f2fs_read_single_page(struct inode *inode, struct page *page, map->m_lblk = block_in_file; map->m_len = last_block - block_in_file; - ret =f2fs_map_blocks (inode, map,0 ,F2FS_GET_BLOCK_DEFAULT ); + ret =f2fs_map_blocks (inode, map,F2FS_GET_BLOCK_DEFAULT );if (ret) goto out; got_it:
@@ -3850,7 +3842,7 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) map.m_next_pgofs =NULL ; map.m_seg_type =NO_CHECK_TYPE ; -if (!f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_BMAP )) +if (!f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_BMAP )) blknr = map.m_pblk; } out:
@@ -3958,7 +3950,7 @@ static int check_swap_activate(struct swap_info_struct *sis, map.m_seg_type =NO_CHECK_TYPE ; map.m_may_create = false; - ret =f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_FIEMAP ); + ret =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_FIEMAP );if (ret) goto out;
@@ -4187,8 +4179,7 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,if (flags &IOMAP_WRITE ) map.m_may_create = true; - err =f2fs_map_blocks (inode, &map, flags &IOMAP_WRITE , -F2FS_GET_BLOCK_DIO ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_DIO );if (err)return err;
fs/f2fs/f2fs.h +1 -2
@@ -3794,8 +3794,7 @@ struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,struct page *f2fs_get_new_data_page (struct inode *inode,struct page *ipage,pgoff_t index,bool new_i_size);int f2fs_do_write_data_page (struct f2fs_io_info *fio); -int f2fs_map_blocks (struct inode *inode,struct f2fs_map_blocks *map, -int create,int flag); +int f2fs_map_blocks (struct inode *inode,struct f2fs_map_blocks *map,int flag);int f2fs_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo,u64 start,u64 len);int f2fs_encrypt_one_page (struct f2fs_io_info *fio);
fs/f2fs/file.c +6 -6
@@ -1800,7 +1800,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset,f2fs_unlock_op (sbi); map.m_seg_type =CURSEG_COLD_DATA_PINNED ; - err =f2fs_map_blocks (inode, &map,1 ,F2FS_GET_BLOCK_PRE_DIO ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_PRE_DIO );file_dont_truncate (inode);f2fs_up_write (&sbi->pin_sem);
@@ -1813,7 +1813,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset, map.m_len = expanded; }else { - err =f2fs_map_blocks (inode, &map,1 ,F2FS_GET_BLOCK_PRE_AIO ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_PRE_AIO ); expanded = map.m_len; } out_err:
@@ -2710,7 +2710,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,*/ while (map.m_lblk < pg_end) { map.m_len = pg_end - map.m_lblk; - err =f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_DEFAULT ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_DEFAULT );if (err) goto out;
@@ -2757,7 +2757,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, do_map: map.m_len = pg_end - map.m_lblk; - err =f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_DEFAULT ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_DEFAULT );if (err) goto clear_out;
@@ -3352,7 +3352,7 @@ int f2fs_precache_extents(struct inode *inode) map.m_len = end - map.m_lblk;f2fs_down_write (&fi->i_gc_rwsem[WRITE ]); - err =f2fs_map_blocks (inode, &map,0 ,F2FS_GET_BLOCK_PRECACHE ); + err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_PRECACHE );f2fs_up_write (&fi->i_gc_rwsem[WRITE ]);if (err)return err;
@@ -4635,7 +4635,7 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter, flag =F2FS_GET_BLOCK_PRE_AIO ; } - ret =f2fs_map_blocks (inode, &map,1 , flag); + ret =f2fs_map_blocks (inode, &map, flag);/* -ENOSPC|-EDQUOT are fine to report the number of allocated blocks. */ if (ret <0 && !((ret == -ENOSPC || ret == -EDQUOT ) && map.m_len >0 ))return ret;
include/trace/events/f2fs.h +4 -7
@@ -564,10 +564,10 @@ TRACE_EVENT(f2fs_file_write_iter, ); TRACE_EVENT(f2fs_map_blocks, - TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, - int create, int flag, int ret), + TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int flag, + int ret), - TP_ARGS(inode, map, create, flag, ret), + TP_ARGS(inode, map, flag, ret), TP_STRUCT__entry( __field(dev_t, dev)
@@ -579,7 +579,6 @@ TRACE_EVENT(f2fs_map_blocks, __field(int, m_seg_type) __field(bool, m_may_create) __field(bool, m_multidev_dio) - __field(int, create) __field(int, flag)__field (int, ret) ),
@@ -594,7 +593,6 @@ TRACE_EVENT(f2fs_map_blocks, __entry->m_seg_type = map->m_seg_type; __entry->m_may_create = map->m_may_create; __entry->m_multidev_dio = map->m_multidev_dio; - __entry->create = create; __entry->flag = flag; __entry->ret = ret; ),
@@ -602,7 +600,7 @@ TRACE_EVENT(f2fs_map_blocks, TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, " "start blkaddr = 0x%llx, len = 0x%llx, flags = %u, " "seg_type = %d, may_create = %d, multidevice = %d, " - "create = %d, flag = %d, err = %d", + "flag = %d, err = %d", show_dev_ino(__entry), (unsigned long long)__entry->m_lblk, (unsigned long long)__entry->m_pblk,
@@ -611,7 +609,6 @@ TRACE_EVENT(f2fs_map_blocks, __entry->m_seg_type, __entry->m_may_create, __entry->m_multidev_dio, - __entry->create, __entry->flag, __entry->ret) );
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 3/4 f2fs: factor a f2fs_map_blocks_cached helper
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 0094e98bd1477a6b7d97c25b47b19a7317c35279 ]
Add a helper to deal with everything needed to return a f2fs_map_blocks structure based on a lookup in the extent cache.
Stable-dep-of: 9d5c4f5c7a2c ("f2fs: fix wrong block mapping for multi-devices")
--- fs/f2fs/data.c | 65 +++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 27 deletions(-)
fs/f2fs/data.c +38 -27
@@ -1459,6 +1459,41 @@ int f2fs_get_block_locked(struct dnode_of_data *dn, pgoff_t index)return err; } +static bool f2fs_map_blocks_cached (struct inode *inode, +struct f2fs_map_blocks *map,int flag) +{ +struct f2fs_sb_info *sbi =F2FS_I_SB (inode); +unsigned int maxblocks = map->m_len; +pgoff_t pgoff = (pgoff_t )map->m_lblk; +struct extent_info ei = {}; + +if (!f2fs_lookup_read_extent_cache (inode, pgoff, &ei)) +return false; + + map->m_pblk = ei.blk + pgoff - ei.fofs; + map->m_len =min ((pgoff_t )maxblocks, ei.fofs + ei.len - pgoff); + map->m_flags =F2FS_MAP_MAPPED ; +if (map->m_next_extent) + *map->m_next_extent = pgoff + map->m_len; + +/* for hardware encryption, but to avoid potential issue in future */ +if (flag ==F2FS_GET_BLOCK_DIO ) +f2fs_wait_on_block_writeback_range (inode, + map->m_pblk, map->m_len); + +if (f2fs_allow_multi_device_dio (sbi, flag)) { +int bidx =f2fs_target_device_index (sbi, map->m_pblk); +struct f2fs_dev_info *dev = &sbi->devs[bidx]; + + map->m_bdev = dev->bdev; + map->m_pblk -= dev->start_blk; + map->m_len =min (map->m_len, dev->end_blk +1 - map->m_pblk); + }else { + map->m_bdev = inode->i_sb->s_bdev; + } +return true; +} +/* * f2fs_map_blocks() tries to find or build mapping relationship which * maps continuous logical blocks to physical blocks, and return such
@@ -1474,7 +1509,6 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)int err =0 , ofs =1 ;unsigned int ofs_in_node, last_ofs_in_node;blkcnt_t prealloc; -struct extent_info ei = {0 , };block_t blkaddr;unsigned int start_pgofs;int bidx =0 ;
@@ -1482,6 +1516,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)if (!maxblocks)return 0 ; +if (!map->m_may_create &&f2fs_map_blocks_cached (inode, map, flag)) + goto out; + map->m_bdev = inode->i_sb->s_bdev; map->m_multidev_dio =f2fs_allow_multi_device_dio (F2FS_I_SB (inode), flag);
@@ -1493,32 +1530,6 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) pgofs = (pgoff_t )map->m_lblk; end = pgofs + maxblocks; -if (map->m_may_create || - !f2fs_lookup_read_extent_cache (inode, pgofs, &ei)) - goto next_dnode; - -/* Found the map in read extent cache */ - map->m_pblk = ei.blk + pgofs - ei.fofs; - map->m_len =min ((pgoff_t )maxblocks, ei.fofs + ei.len - pgofs); - map->m_flags =F2FS_MAP_MAPPED ; -if (map->m_next_extent) - *map->m_next_extent = pgofs + map->m_len; - -/* for hardware encryption, but to avoid potential issue in future */ -if (flag ==F2FS_GET_BLOCK_DIO ) -f2fs_wait_on_block_writeback_range (inode, - map->m_pblk, map->m_len); - -if (map->m_multidev_dio) { - bidx =f2fs_target_device_index (sbi, map->m_pblk); - - map->m_bdev =FDEV (bidx).bdev; - map->m_pblk -=FDEV (bidx).start_blk; - map->m_len =min (map->m_len, -FDEV (bidx).end_blk +1 - map->m_pblk); - } - goto out; - next_dnode:if (map->m_may_create)f2fs_do_map_lock (sbi, flag, true);
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 4/4 f2fs: fix wrong block mapping for multi-devices
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 9d5c4f5c7a2c7677e1b3942772122b032c265aae ]
Assuming the disk layout as below,
disk0: 0 --- 0x00035abfff
disk1: 0x00035ac000 --- 0x00037abfff
disk2: 0x00037ac000 --- 0x00037ebfff
and we want to read data from offset=13568 having len=128 across the block devices, we can illustrate the block addresses like below.
0 .. 0x00037ac000 ------------------- 0x00037ebfff, 0x00037ec000 -------
| ^ ^ ^
| fofs 0 13568 13568+128
| ------------------------------------------------------
| LBA 0x37e8aa9 0x37ebfa9 0x37ec029
--- map 0x3caa9 0x3ffa9In this example, we should give the relative map of the target block device ranging from 0x3caa9 to 0x3ffa9 where the length should be calculated by 0x37ebfff + 1 - 0x37ebfa9.
In the below equation, however, map->m_pblk was supposed to be the original address instead of the one from the target block address.
- map->m_len = min(map->m_len, dev->end_blk + 1 - map->m_pblk);
--- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +1 -1
@@ -1486,8 +1486,8 @@ static bool f2fs_map_blocks_cached(struct inode *inode,struct f2fs_dev_info *dev = &sbi->devs[bidx]; map->m_bdev = dev->bdev; - map->m_pblk -= dev->start_blk; map->m_len =min (map->m_len, dev->end_blk +1 - map->m_pblk); + map->m_pblk -= dev->start_blk; }else { map->m_bdev = inode->i_sb->s_bdev; }
Signature · 1 line
2.51.0