Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36abef4e authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: introduce mode=lfs mount option



This mount option is to enable original log-structured filesystem forcefully.
So, there should be no random writes for main area.

Especially, this supports host-managed SMR device.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent aa987273
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -151,6 +151,9 @@ noinline_data Disable the inline data feature, inline data feature is
                       enabled by default.
data_flush             Enable data flushing before checkpoint in order to
                       persist data of regular and symlink.
mode=%s                Control block allocation mode which supports "adaptive"
                       and "lfs". In "lfs" mode, there should be no random
                       writes towards main area.

================================================================================
DEBUGFS ENTRIES
+1 −1
Original line number Diff line number Diff line
@@ -981,7 +981,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
	 * This avoids to conduct wrong roll-forward operations and uses
	 * metapages, so should be called prior to sync_meta_pages below.
	 */
	if (discard_next_dnode(sbi, discard_blk))
	if (!test_opt(sbi, LFS) && discard_next_dnode(sbi, discard_blk))
		invalidate = true;

	/* Flush all the NAT/SIT pages */
+2 −0
Original line number Diff line number Diff line
@@ -1710,6 +1710,8 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)

	if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode))
		return 0;
	if (test_opt(F2FS_I_SB(inode), LFS))
		return 0;

	trace_f2fs_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));

+2 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ static inline bool time_to_inject(int type)
#define F2FS_MOUNT_FORCE_FG_GC		0x00004000
#define F2FS_MOUNT_DATA_FLUSH		0x00008000
#define F2FS_MOUNT_FAULT_INJECTION	0x00010000
#define F2FS_MOUNT_ADAPTIVE		0x00020000
#define F2FS_MOUNT_LFS			0x00040000

#define clear_opt(sbi, option)	(sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
#define set_opt(sbi, option)	(sbi->mount_opt.opt |= F2FS_MOUNT_##option)
+7 −1
Original line number Diff line number Diff line
@@ -878,9 +878,15 @@ static int __exchange_data_block(struct inode *inode, pgoff_t src,
		return full ? truncate_hole(inode, dst, dst + 1) : 0;

	if (do_replace) {
		struct page *ipage = get_node_page(sbi, inode->i_ino);
		struct page *ipage;
		struct node_info ni;

		if (test_opt(sbi, LFS)) {
			ret = -ENOTSUPP;
			goto err_out;
		}

		ipage = get_node_page(sbi, inode->i_ino);
		if (IS_ERR(ipage)) {
			ret = PTR_ERR(ipage);
			goto err_out;
Loading