diff options
Diffstat (limited to 'fs/sync.c')
-rw-r--r-- | fs/sync.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/file.h> | 6 | #include <linux/file.h> |
7 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
8 | #include <linux/slab.h> | ||
8 | #include <linux/module.h> | 9 | #include <linux/module.h> |
9 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
10 | #include <linux/writeback.h> | 11 | #include <linux/writeback.h> |
@@ -13,6 +14,7 @@ | |||
13 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
14 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
15 | #include <linux/buffer_head.h> | 16 | #include <linux/buffer_head.h> |
17 | #include <linux/backing-dev.h> | ||
16 | #include "internal.h" | 18 | #include "internal.h" |
17 | 19 | ||
18 | #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ | 20 | #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ |
@@ -31,17 +33,17 @@ static int __sync_filesystem(struct super_block *sb, int wait) | |||
31 | * This should be safe, as we require bdi backing to actually | 33 | * This should be safe, as we require bdi backing to actually |
32 | * write out data in the first place | 34 | * write out data in the first place |
33 | */ | 35 | */ |
34 | if (!sb->s_bdi) | 36 | if (!sb->s_bdi || sb->s_bdi == &noop_backing_dev_info) |
35 | return 0; | 37 | return 0; |
36 | 38 | ||
37 | /* Avoid doing twice syncing and cache pruning for quota sync */ | 39 | if (sb->s_qcop && sb->s_qcop->quota_sync) |
38 | if (!wait) { | 40 | sb->s_qcop->quota_sync(sb, -1, wait); |
39 | writeout_quota_sb(sb, -1); | 41 | |
40 | writeback_inodes_sb(sb); | 42 | if (wait) |
41 | } else { | ||
42 | sync_quota_sb(sb, -1); | ||
43 | sync_inodes_sb(sb); | 43 | sync_inodes_sb(sb); |
44 | } | 44 | else |
45 | writeback_inodes_sb(sb); | ||
46 | |||
45 | if (sb->s_op->sync_fs) | 47 | if (sb->s_op->sync_fs) |
46 | sb->s_op->sync_fs(sb, wait); | 48 | sb->s_op->sync_fs(sb, wait); |
47 | return __sync_blockdev(sb->s_bdev, wait); | 49 | return __sync_blockdev(sb->s_bdev, wait); |