diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-07-12 10:28:49 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-22 15:58:09 -0400 |
commit | 5687b5780e90278a62d4cd916a3632087066f59d (patch) | |
tree | 362f5c4b25cc1edd9ae69ac561192859cfd9c201 /fs/hfs/super.c | |
parent | b16ca626358cbf056b752eab63ba8f20087afeaf (diff) |
hfs: get rid of hfs_sync_super
This patch makes hfs stop using the VFS '->write_super()' method along with
the 's_dirt' superblock flag, because they are on their way out.
The whole "superblock write-out" VFS infrastructure is served by the
'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and
writes out all dirty superblocks using the '->write_super()' call-back. But the
problem with this thread is that it wastes power by waking up the system every
5 seconds, even if there are no diry superblocks, or there are no client
file-systems which would need this (e.g., btrfs does not use
'->write_super()'). So we want to kill it completely and thus, we need to make
file-systems to stop using the '->write_super()' VFS service, and then remove
it together with the kernel thread.
Tested using fsstress from the LTP project.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hfs/super.c')
-rw-r--r-- | fs/hfs/super.c | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 99c6239bc3a1..4eb873e0c07b 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -29,38 +29,9 @@ static struct kmem_cache *hfs_inode_cachep; | |||
29 | 29 | ||
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
31 | 31 | ||
32 | /* | ||
33 | * hfs_write_super() | ||
34 | * | ||
35 | * Description: | ||
36 | * This function is called by the VFS only. When the filesystem | ||
37 | * is mounted r/w it updates the MDB on disk. | ||
38 | * Input Variable(s): | ||
39 | * struct super_block *sb: Pointer to the hfs superblock | ||
40 | * Output Variable(s): | ||
41 | * NONE | ||
42 | * Returns: | ||
43 | * void | ||
44 | * Preconditions: | ||
45 | * 'sb' points to a "valid" (struct super_block). | ||
46 | * Postconditions: | ||
47 | * The MDB is marked 'unsuccessfully unmounted' by clearing bit 8 of drAtrb | ||
48 | * (hfs_put_super() must set this flag!). Some MDB fields are updated | ||
49 | * and the MDB buffer is written to disk by calling hfs_mdb_commit(). | ||
50 | */ | ||
51 | static void hfs_write_super(struct super_block *sb) | ||
52 | { | ||
53 | sb->s_dirt = 0; | ||
54 | |||
55 | /* sync everything to the buffers */ | ||
56 | hfs_mdb_commit(sb); | ||
57 | } | ||
58 | |||
59 | static int hfs_sync_fs(struct super_block *sb, int wait) | 32 | static int hfs_sync_fs(struct super_block *sb, int wait) |
60 | { | 33 | { |
61 | hfs_mdb_commit(sb); | 34 | hfs_mdb_commit(sb); |
62 | sb->s_dirt = 0; | ||
63 | |||
64 | return 0; | 35 | return 0; |
65 | } | 36 | } |
66 | 37 | ||
@@ -73,11 +44,44 @@ static int hfs_sync_fs(struct super_block *sb, int wait) | |||
73 | */ | 44 | */ |
74 | static void hfs_put_super(struct super_block *sb) | 45 | static void hfs_put_super(struct super_block *sb) |
75 | { | 46 | { |
47 | cancel_delayed_work_sync(&HFS_SB(sb)->mdb_work); | ||
76 | hfs_mdb_close(sb); | 48 | hfs_mdb_close(sb); |
77 | /* release the MDB's resources */ | 49 | /* release the MDB's resources */ |
78 | hfs_mdb_put(sb); | 50 | hfs_mdb_put(sb); |
79 | } | 51 | } |
80 | 52 | ||
53 | static void flush_mdb(struct work_struct *work) | ||
54 | { | ||
55 | struct hfs_sb_info *sbi; | ||
56 | struct super_block *sb; | ||
57 | |||
58 | sbi = container_of(work, struct hfs_sb_info, mdb_work.work); | ||
59 | sb = sbi->sb; | ||
60 | |||
61 | spin_lock(&sbi->work_lock); | ||
62 | sbi->work_queued = 0; | ||
63 | spin_unlock(&sbi->work_lock); | ||
64 | |||
65 | hfs_mdb_commit(sb); | ||
66 | } | ||
67 | |||
68 | void hfs_mark_mdb_dirty(struct super_block *sb) | ||
69 | { | ||
70 | struct hfs_sb_info *sbi = HFS_SB(sb); | ||
71 | unsigned long delay; | ||
72 | |||
73 | if (sb->s_flags & MS_RDONLY) | ||
74 | return; | ||
75 | |||
76 | spin_lock(&sbi->work_lock); | ||
77 | if (!sbi->work_queued) { | ||
78 | delay = msecs_to_jiffies(dirty_writeback_interval * 10); | ||
79 | queue_delayed_work(system_long_wq, &sbi->mdb_work, delay); | ||
80 | sbi->work_queued = 1; | ||
81 | } | ||
82 | spin_unlock(&sbi->work_lock); | ||
83 | } | ||
84 | |||
81 | /* | 85 | /* |
82 | * hfs_statfs() | 86 | * hfs_statfs() |
83 | * | 87 | * |
@@ -177,7 +181,6 @@ static const struct super_operations hfs_super_operations = { | |||
177 | .write_inode = hfs_write_inode, | 181 | .write_inode = hfs_write_inode, |
178 | .evict_inode = hfs_evict_inode, | 182 | .evict_inode = hfs_evict_inode, |
179 | .put_super = hfs_put_super, | 183 | .put_super = hfs_put_super, |
180 | .write_super = hfs_write_super, | ||
181 | .sync_fs = hfs_sync_fs, | 184 | .sync_fs = hfs_sync_fs, |
182 | .statfs = hfs_statfs, | 185 | .statfs = hfs_statfs, |
183 | .remount_fs = hfs_remount, | 186 | .remount_fs = hfs_remount, |
@@ -382,6 +385,8 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
382 | 385 | ||
383 | sbi->sb = sb; | 386 | sbi->sb = sb; |
384 | sb->s_fs_info = sbi; | 387 | sb->s_fs_info = sbi; |
388 | spin_lock_init(&sbi->work_lock); | ||
389 | INIT_DELAYED_WORK(&sbi->mdb_work, flush_mdb); | ||
385 | 390 | ||
386 | res = -EINVAL; | 391 | res = -EINVAL; |
387 | if (!parse_options((char *)data, sbi)) { | 392 | if (!parse_options((char *)data, sbi)) { |