From: Artem Bityutskiy <dedekind@yandex.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
LKML <linux-kernel@vger.kernel.org>,
Adrian Hunter <ext-adrian.hunter@nokia.com>,
Edward Shishkin <edward.shishkin@gmail.com>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH take 2 01/28] VFS: introduce writeback_inodes_sb()
Date: Wed, 07 May 2008 19:55:47 +0300 [thread overview]
Message-ID: <4821DF13.2010207@yandex.ru> (raw)
In-Reply-To: <20080507083835.6ba126e6.akpm@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
Andrew Morton wrote:
> I already added gti-ubifs.patch to the -mm lineup. I haven't yet tried
> pulling, merging or compiling it.
Cool.
> I'd suggest that you just retain this patch in your tree.
>
>> Should I amend the reiser4 patch correspondingly for you?
>
> That would be nice, if you have time, thanks.
I've split the original patch on 3 pieces:
1. VFS: move inode_lock into sync_sb_inodes
2. VFS: export sync_sb_inodes
3. VFS: introduce sync_inodes superblock operation
The first 2 are exactly what UBIFS also needs. The third one is only
needed for Reiser4. The patches are attached.
I am not sure this is the best way to split. The second patch could
just export sync_sb_inodes() without renaming it to
generic_sync_sb_inodes(). But in this case we would have more complex
third patch and more dependencies between reiser4 and ubifs. What is
better?
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
[-- Attachment #2: 0001-VFS-move-inode_lock-into-sync_sb_inodes.patch --]
[-- Type: text/x-patch, Size: 2384 bytes --]
>From 8b8614f78c3d97ac1980ca4205d8d9f52599ac14 Mon Sep 17 00:00:00 2001
From: Hans Reiser <reiser@namesys.com>
Date: Wed, 7 May 2008 15:48:57 +0300
Subject: [PATCH] VFS: move inode_lock into sync_sb_inodes
This patch makes 'sync_sb_inodes()' lock 'inode_lock', rather
than expect that the caller will do this.
This change was previously done by Hans Reiser <reiser@namesys.com>
and sat in the -mm tree.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
fs/fs-writeback.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index ae45f77..16519fe 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -424,8 +424,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
* WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so
* that it can be located for waiting on in __writeback_single_inode().
*
- * Called under inode_lock.
- *
* If `bdi' is non-zero then we're being asked to writeback a specific queue.
* This function assumes that the blockdev superblock's inodes are backed by
* a variety of queues, so all inodes are searched. For other superblocks,
@@ -446,6 +444,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
{
const unsigned long start = jiffies; /* livelock avoidance */
+ spin_lock(&inode_lock);
if (!wbc->for_kupdate || list_empty(&sb->s_io))
queue_io(sb, wbc->older_than_this);
@@ -524,6 +523,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
if (!list_empty(&sb->s_more_io))
wbc->more_io = 1;
}
+ spin_unlock(&inode_lock);
return; /* Leave any unwritten inodes on s_io */
}
@@ -565,11 +565,8 @@ restart:
* be unmounted by the time it is released.
*/
if (down_read_trylock(&sb->s_umount)) {
- if (sb->s_root) {
- spin_lock(&inode_lock);
+ if (sb->s_root)
sync_sb_inodes(sb, wbc);
- spin_unlock(&inode_lock);
- }
up_read(&sb->s_umount);
}
spin_lock(&sb_lock);
@@ -607,9 +604,7 @@ void sync_inodes_sb(struct super_block *sb, int wait)
(inodes_stat.nr_inodes - inodes_stat.nr_unused) +
nr_dirty + nr_unstable;
wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */
- spin_lock(&inode_lock);
sync_sb_inodes(sb, &wbc);
- spin_unlock(&inode_lock);
}
/*
--
1.5.4.1
[-- Attachment #3: 0002-VFS-export-sync_sb_inodes.patch --]
[-- Type: text/x-patch, Size: 2371 bytes --]
>From 42ccbfa209e4799e5f60b5ec6878da1c447d29b2 Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Date: Wed, 7 May 2008 21:01:30 +0300
Subject: [PATCH] VFS: export sync_sb_inodes
This patch exports the 'sync_sb_inodes()' which is needed for
UBIFS because it have to force write-back from time to time.
Namely, the UBIFS budgeting subsystem forces write-back when
its pessimistic callculations show that there is not free
space on the media.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
fs/fs-writeback.c | 11 +++++++++--
include/linux/fs.h | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 16519fe..25adfc3 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -439,8 +439,8 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
* on the writer throttling path, and we get decent balancing between many
* throttled threads: we don't want them all piling up on inode_sync_wait.
*/
-static void
-sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
+void generic_sync_sb_inodes(struct super_block *sb,
+ struct writeback_control *wbc)
{
const unsigned long start = jiffies; /* livelock avoidance */
@@ -526,6 +526,13 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
spin_unlock(&inode_lock);
return; /* Leave any unwritten inodes on s_io */
}
+EXPORT_SYMBOL_GPL(generic_sync_sb_inodes);
+
+static void sync_sb_inodes(struct super_block *sb,
+ struct writeback_control *wbc)
+{
+ generic_sync_sb_inodes(sb, wbc);
+}
/*
* Start writeback of dirty pagecache data against all unlocked inodes.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7e0fa9e..85ee6cf 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1730,6 +1730,8 @@ static inline void invalidate_remote_inode(struct inode *inode)
extern int invalidate_inode_pages2(struct address_space *mapping);
extern int invalidate_inode_pages2_range(struct address_space *mapping,
pgoff_t start, pgoff_t end);
+extern void generic_sync_sb_inodes(struct super_block *sb,
+ struct writeback_control *wbc);
extern int write_inode_now(struct inode *, int);
extern int filemap_fdatawrite(struct address_space *);
extern int filemap_flush(struct address_space *);
--
1.5.4.1
[-- Attachment #4: 0003-VFS-introduce-sync_inodes-superblock-operation.patch --]
[-- Type: text/x-patch, Size: 1942 bytes --]
>From 3627f07f280e519db66056f39a23abd267400218 Mon Sep 17 00:00:00 2001
From: Hans Reiser <reiser@namesys.com>
Date: Wed, 7 May 2008 21:04:39 +0300
Subject: [PATCH] VFS: introduce sync_inodes superblock operation
This patch adds new operation to struct super_operations - sync_inodes,
generic implementaion and changes fs-writeback.c:sync_sb_inodes() to call
filesystem's sync_inodes if it is defined or generic implementaion otherwise.
This new operation allows filesystem to decide itself what to flush.
Reiser4 flushes dirty pages on basic of atoms, not of inodes. sync_sb_inodes
used to call address space flushing method (writepages) for every dirty inode.
For reiser4 it caused having to commit atoms unnecessarily often. This
turned into substantial slowdown. Having this method helped to fix that
problem.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
fs/fs-writeback.c | 5 ++++-
include/linux/fs.h | 2 ++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 25adfc3..495214d 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -531,7 +531,10 @@ EXPORT_SYMBOL_GPL(generic_sync_sb_inodes);
static void sync_sb_inodes(struct super_block *sb,
struct writeback_control *wbc)
{
- generic_sync_sb_inodes(sb, wbc);
+ if (sb->s_op->sync_inodes)
+ sb->s_op->sync_inodes(sb, wbc);
+ else
+ generic_sync_sb_inodes(sb, wbc);
}
/*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 85ee6cf..777494b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1307,6 +1307,8 @@ struct super_operations {
void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *);
+ void (*sync_inodes)(struct super_block *sb,
+ struct writeback_control *wbc);
int (*show_options)(struct seq_file *, struct vfsmount *);
int (*show_stats)(struct seq_file *, struct vfsmount *);
#ifdef CONFIG_QUOTA
--
1.5.4.1
next prev parent reply other threads:[~2008-05-07 16:56 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-06 10:35 [PATCH take 2] UBIFS - new flash file system Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 01/28] VFS: introduce writeback_inodes_sb() Artem Bityutskiy
2008-05-07 7:23 ` Andrew Morton
2008-05-07 8:00 ` Christoph Hellwig
2008-05-13 8:31 ` Artem Bityutskiy
2008-05-13 8:59 ` Christoph Hellwig
2008-05-13 9:22 ` Artem Bityutskiy
2008-05-07 11:14 ` Artem Bityutskiy
2008-05-07 12:01 ` Artem Bityutskiy
2008-05-07 15:38 ` Andrew Morton
2008-05-07 16:55 ` Artem Bityutskiy [this message]
2008-05-08 10:11 ` Artem Bityutskiy
2008-05-20 12:45 ` Artem Bityutskiy
2008-05-20 17:49 ` Andrew Morton
2008-05-22 10:53 ` Artem Bityutskiy
2008-05-22 11:00 ` Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 02/28] do_mounts: allow UBI root device name Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 03/28] UBIFS: add brief documentation Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 04/28] UBIFS: add I/O sub-system Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 05/28] UBIFS: add flash scanning Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 06/28] UBIFS: add journal replay Artem Bityutskiy
2008-05-06 22:05 ` Marcin Slusarz
2008-05-07 5:57 ` Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 07/28] UBIFS: add file-system build Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 08/28] UBIFS: add superblock and master node Artem Bityutskiy
2008-05-06 23:48 ` Kyungmin Park
2008-05-07 6:07 ` Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 09/28] UBIFS: add file-system recovery Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 10/28] UBIFS: add compression support Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 11/28] UBIFS: add key helpers Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 12/28] UBIFS: add the journal Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 13/28] UBIFS: add commit functionality Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 14/28] UBIFS: add TNC implementation Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 15/28] UBIFS: add TNC commit implementation Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 16/28] UBIFS: add TNC shrinker Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 17/28] UBIFS: add LEB properties Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 18/28] UBIFS: add LEB properties tree Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 19/28] " Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 20/28] UBIFS: add LEB find subsystem Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 21/28] UBIFS: add Garbage Collector Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 22/28] UBIFS: add VFS operations Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 23/28] UBIFS: add budgeting Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 24/28] UBIFS: add extended attribute support Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 25/28] UBIFS: add orphans handling sub-system Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 26/28] UBIFS: add header files Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 27/28] UBIFS: add debugging stuff Artem Bityutskiy
2008-05-06 10:35 ` [PATCH take 2 28/28] UBIFS: include FS to compilation Artem Bityutskiy
2008-05-07 8:01 ` [PATCH take 2] UBIFS - new flash file system Christoph Hellwig
2008-05-07 8:07 ` Artem Bityutskiy
2008-05-07 8:10 ` Christoph Hellwig
2008-05-07 8:11 ` Artem Bityutskiy
2008-05-07 8:32 ` Artem Bityutskiy
2008-05-07 10:31 ` Artem Bityutskiy
2008-05-16 10:40 ` Christoph Hellwig
2008-05-16 13:10 ` Adrian Hunter
2008-05-19 11:30 ` Artem Bityutskiy
2008-05-19 12:36 ` Andi Kleen
2008-05-23 15:18 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4821DF13.2010207@yandex.ru \
--to=dedekind@yandex.ru \
--cc=Artem.Bityutskiy@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=edward.shishkin@gmail.com \
--cc=ext-adrian.hunter@nokia.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox