lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1357969323-9396-1-git-send-email-linkinjeon@gmail.com>
Date:	Sat, 12 Jan 2013 14:42:03 +0900
From:	Namjae Jeon <linkinjeon@...il.com>
To:	jaegeuk.kim@...sung.com
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-f2fs-devel@...ts.sourceforge.net,
	Namjae Jeon <linkinjeon@...il.com>,
	Namjae Jeon <namjae.jeon@...sung.com>,
	Amit Sahrawat <a.sahrawat@...sung.com>
Subject: [PATCH 4/4] f2fs: add blk plugging support in f2fs

From: Namjae Jeon <namjae.jeon@...sung.com>

With f2fs having different writepages support for data, node and metapages.
It will not be covered under the generic blk plug support.
So,
1) modified the writepages for data pages.
2) Added blk plugging in node/metapages.

Signed-off-by: Namjae Jeon <namjae.jeon@...sung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@...sung.com>
---
 fs/f2fs/checkpoint.c |    3 +++
 fs/f2fs/data.c       |   14 +++++++++++++-
 fs/f2fs/node.c       |    4 +++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 448f728..127a904 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -129,10 +129,12 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
 	struct writeback_control wbc = {
 		.for_reclaim = 0,
 	};
+	struct blk_plug plug;
 
 	trace_f2fs_sync_pages(sbi->sb, type, nr_to_write);
 	pagevec_init(&pvec, 0);
 
+	blk_start_plug(&plug);
 	while (index <= end) {
 		int i, nr_pages;
 		nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
@@ -158,6 +160,7 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
 	if (nwritten)
 		f2fs_submit_bio(sbi, type, nr_to_write == LONG_MAX);
 
+	blk_finish_plug(&plug);
 	return nwritten;
 }
 
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 1d7dbb4..5203a5d 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -558,6 +558,15 @@ redirty_out:
 
 #define MAX_DESIRED_PAGES_WP	4096
 
+static int __f2fs_writepage(struct page *page, struct writeback_control *wbc,
+			void *data)
+{
+	struct address_space *mapping = data;
+	int ret = mapping->a_ops->writepage(page, wbc);
+	mapping_set_error(mapping, ret);
+	return ret;
+}
+
 static int f2fs_write_data_pages(struct address_space *mapping,
 			    struct writeback_control *wbc)
 {
@@ -565,6 +574,7 @@ static int f2fs_write_data_pages(struct address_space *mapping,
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
 	int ret;
 	long excess_nrtw = 0, desired_nrtw;
+	struct blk_plug plug;
 
 	if (wbc->nr_to_write < MAX_DESIRED_PAGES_WP) {
 		desired_nrtw = MAX_DESIRED_PAGES_WP;
@@ -572,12 +582,14 @@ static int f2fs_write_data_pages(struct address_space *mapping,
 		wbc->nr_to_write = desired_nrtw;
 	}
 
+	blk_start_plug(&plug);
 	if (!S_ISDIR(inode->i_mode))
 		mutex_lock(&sbi->writepages);
-	ret = generic_writepages(mapping, wbc);
+	ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping);
 	if (!S_ISDIR(inode->i_mode))
 		mutex_unlock(&sbi->writepages);
 	f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL));
+	blk_finish_plug(&plug);
 
 	remove_dirty_dir_inode(inode);
 
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 40ceda2..49a5806 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -999,9 +999,10 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,
 	struct pagevec pvec;
 	int step = ino ? 2 : 0;
 	int nwritten = 0, wrote = 0;
-
+	struct blk_plug plug;
 	pagevec_init(&pvec, 0);
 
+	blk_start_plug(&plug);
 next_step:
 	index = 0;
 	end = LONG_MAX;
@@ -1090,6 +1091,7 @@ continue_unlock:
 
 	if (wrote)
 		f2fs_submit_bio(sbi, NODE, wbc->sync_mode == WB_SYNC_ALL);
+	blk_finish_plug(&plug);
 
 	return nwritten;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists