* [PATCH v2] f2fs: avoid unused block when dio write in LFS mode [not found] <CGME20240905052433epcms2p1dac78dff43776cc158bac5ae9d118160@epcms2p1> @ 2024-09-05 5:24 ` Daejun Park 2024-09-05 6:43 ` Chao Yu 2024-09-16 21:30 ` [f2fs-dev] " patchwork-bot+f2fs 0 siblings, 2 replies; 3+ messages in thread From: Daejun Park @ 2024-09-05 5:24 UTC (permalink / raw) To: Chao Yu, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Seokhwan Kim, Dongjin Kim, Yonggil Song, Jaeyoon Choi, Nayeon Kim, Siwoo Jung, Daejun Park This patch addresses the problem that when using LFS mode, unused blocks may occur in f2fs_map_blocks() during block allocation for dio writes. If a new section is allocated during block allocation, it will not be included in the map struct by map_is_mergeable() if the LBA of the allocated block is not contiguous. However, the block already allocated in this process will remain unused due to the LFS mode. This patch avoids the possibility of unused blocks by escaping f2fs_map_blocks() when allocating the last block in a section. Signed-off-by: Daejun Park <daejun7.park@samsung.com> --- v2: Applied segment check code suggested by Chao Yu. fs/f2fs/data.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c6d688208f8b..b94cf6eea2f9 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1712,6 +1712,14 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) dn.ofs_in_node = end_offset; } + if (flag == F2FS_GET_BLOCK_DIO && f2fs_lfs_mode(sbi) && + map->m_may_create) { + /* the next block to be allocated may not be contiguous. */ + if (GET_SEGOFF_FROM_SEG0(sbi, blkaddr) % BLKS_PER_SEC(sbi) == + CAP_BLKS_PER_SEC(sbi) - 1) + goto sync_out; + } + if (pgofs >= end) goto sync_out; else if (dn.ofs_in_node < end_offset) -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] f2fs: avoid unused block when dio write in LFS mode 2024-09-05 5:24 ` [PATCH v2] f2fs: avoid unused block when dio write in LFS mode Daejun Park @ 2024-09-05 6:43 ` Chao Yu 2024-09-16 21:30 ` [f2fs-dev] " patchwork-bot+f2fs 1 sibling, 0 replies; 3+ messages in thread From: Chao Yu @ 2024-09-05 6:43 UTC (permalink / raw) To: daejun7.park, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Seokhwan Kim, Dongjin Kim, Yonggil Song, Jaeyoon Choi, Nayeon Kim, Siwoo Jung On 2024/9/5 13:24, Daejun Park wrote: > This patch addresses the problem that when using LFS mode, unused blocks > may occur in f2fs_map_blocks() during block allocation for dio writes. > > If a new section is allocated during block allocation, it will not be > included in the map struct by map_is_mergeable() if the LBA of the > allocated block is not contiguous. However, the block already allocated > in this process will remain unused due to the LFS mode. > > This patch avoids the possibility of unused blocks by escaping > f2fs_map_blocks() when allocating the last block in a section. > > Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: avoid unused block when dio write in LFS mode 2024-09-05 5:24 ` [PATCH v2] f2fs: avoid unused block when dio write in LFS mode Daejun Park 2024-09-05 6:43 ` Chao Yu @ 2024-09-16 21:30 ` patchwork-bot+f2fs 1 sibling, 0 replies; 3+ messages in thread From: patchwork-bot+f2fs @ 2024-09-16 21:30 UTC (permalink / raw) To: Daejun Park Cc: chao, jaegeuk, linux-f2fs-devel, linux-kernel, nayeoni.kim, siu.jung, sukka.kim, dongjin_.kim Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <jaegeuk@kernel.org>: On Thu, 05 Sep 2024 14:24:33 +0900 you wrote: > This patch addresses the problem that when using LFS mode, unused blocks > may occur in f2fs_map_blocks() during block allocation for dio writes. > > If a new section is allocated during block allocation, it will not be > included in the map struct by map_is_mergeable() if the LBA of the > allocated block is not contiguous. However, the block already allocated > in this process will remain unused due to the LFS mode. > > [...] Here is the summary with links: - [f2fs-dev,v2] f2fs: avoid unused block when dio write in LFS mode https://git.kernel.org/jaegeuk/f2fs/c/0638a3197c19 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-16 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240905052433epcms2p1dac78dff43776cc158bac5ae9d118160@epcms2p1>
2024-09-05 5:24 ` [PATCH v2] f2fs: avoid unused block when dio write in LFS mode Daejun Park
2024-09-05 6:43 ` Chao Yu
2024-09-16 21:30 ` [f2fs-dev] " patchwork-bot+f2fs
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox