aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@tuxera.com>2010-11-23 08:38:21 -0500
committerChristoph Hellwig <hch@lst.de>2010-11-23 08:38:21 -0500
commit34a2d313c51f47cae50ccb89f4196462665f2c48 (patch)
treec641c7bd24b9e343139a3e1c4d81e51822114cd9 /fs
parente34947056076ca5467ee8256d2d9cbc594a79b37 (diff)
hfsplus: flush disk caches in sync and fsync
Flush the disk cache in fsync and sync to make sure data actually is on disk on completion of these system calls. There is a nobarrier mount option to disable this behaviour. It's slightly misnamed now that barrier actually are gone, but it matches the name used by all major filesystems. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/hfsplus/hfsplus_fs.h1
-rw-r--r--fs/hfsplus/inode.c4
-rw-r--r--fs/hfsplus/options.c11
-rw-r--r--fs/hfsplus/super.c5
4 files changed, 21 insertions, 0 deletions
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 65c698f78ef7..17ac254e72cb 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -156,6 +156,7 @@ struct hfsplus_sb_info {
156#define HFSPLUS_SB_FORCE 2 156#define HFSPLUS_SB_FORCE 2
157#define HFSPLUS_SB_HFSX 3 157#define HFSPLUS_SB_HFSX 3
158#define HFSPLUS_SB_CASEFOLD 4 158#define HFSPLUS_SB_CASEFOLD 4
159#define HFSPLUS_SB_NOBARRIER 5
159 160
160static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) 161static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb)
161{ 162{
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index bf6535b73261..bda7464c205d 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -8,6 +8,7 @@
8 * Inode handling routines 8 * Inode handling routines
9 */ 9 */
10 10
11#include <linux/blkdev.h>
11#include <linux/mm.h> 12#include <linux/mm.h>
12#include <linux/fs.h> 13#include <linux/fs.h>
13#include <linux/pagemap.h> 14#include <linux/pagemap.h>
@@ -334,6 +335,9 @@ int hfsplus_file_fsync(struct file *file, int datasync)
334 error = error2; 335 error = error2;
335 } 336 }
336 337
338 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
339 blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
340
337 return error; 341 return error;
338} 342}
339 343
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c
index 43b02b5525eb..dbd9d0c426cb 100644
--- a/fs/hfsplus/options.c
+++ b/fs/hfsplus/options.c
@@ -23,6 +23,7 @@ enum {
23 opt_umask, opt_uid, opt_gid, 23 opt_umask, opt_uid, opt_gid,
24 opt_part, opt_session, opt_nls, 24 opt_part, opt_session, opt_nls,
25 opt_nodecompose, opt_decompose, 25 opt_nodecompose, opt_decompose,
26 opt_barrier, opt_nobarrier,
26 opt_force, opt_err 27 opt_force, opt_err
27}; 28};
28 29
@@ -37,6 +38,8 @@ static const match_table_t tokens = {
37 { opt_nls, "nls=%s" }, 38 { opt_nls, "nls=%s" },
38 { opt_decompose, "decompose" }, 39 { opt_decompose, "decompose" },
39 { opt_nodecompose, "nodecompose" }, 40 { opt_nodecompose, "nodecompose" },
41 { opt_barrier, "barrier" },
42 { opt_nobarrier, "nobarrier" },
40 { opt_force, "force" }, 43 { opt_force, "force" },
41 { opt_err, NULL } 44 { opt_err, NULL }
42}; 45};
@@ -174,6 +177,12 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
174 case opt_nodecompose: 177 case opt_nodecompose:
175 set_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags); 178 set_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags);
176 break; 179 break;
180 case opt_barrier:
181 clear_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags);
182 break;
183 case opt_nobarrier:
184 set_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags);
185 break;
177 case opt_force: 186 case opt_force:
178 set_bit(HFSPLUS_SB_FORCE, &sbi->flags); 187 set_bit(HFSPLUS_SB_FORCE, &sbi->flags);
179 break; 188 break;
@@ -212,5 +221,7 @@ int hfsplus_show_options(struct seq_file *seq, struct vfsmount *mnt)
212 seq_printf(seq, ",nls=%s", sbi->nls->charset); 221 seq_printf(seq, ",nls=%s", sbi->nls->charset);
213 if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags)) 222 if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags))
214 seq_printf(seq, ",nodecompose"); 223 seq_printf(seq, ",nodecompose");
224 if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
225 seq_printf(seq, ",nobarrier");
215 return 0; 226 return 0;
216} 227}
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 036650123c4c..154478c71f25 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/blkdev.h>
13#include <linux/fs.h> 14#include <linux/fs.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/vfs.h> 16#include <linux/vfs.h>
@@ -212,6 +213,10 @@ int hfsplus_sync_fs(struct super_block *sb, int wait)
212out: 213out:
213 mutex_unlock(&sbi->alloc_mutex); 214 mutex_unlock(&sbi->alloc_mutex);
214 mutex_unlock(&sbi->vh_mutex); 215 mutex_unlock(&sbi->vh_mutex);
216
217 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
218 blkdev_issue_flush(sb->s_bdev, GFP_KERNEL, NULL);
219
215 return error; 220 return error;
216} 221}
217 222