diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2012-11-30 20:56:01 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-10 23:43:43 -0500 |
commit | 1fa95b0b6798164a31c1048efdf62b71038eb3d5 (patch) | |
tree | 74b664e5effef9e7cf0764f069d3081386a53539 /fs/f2fs/file.c | |
parent | 154a086529b50236782a2d4365a1d1c359adc7af (diff) |
f2fs: check read only condition before beginning write out
If the filesystem is mounted as read-only then return from that point itself
instead of first doing a writeout/wait and then checking for read-only
condition.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index c1a108ffbfcc..89241c50eb96 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -132,14 +132,15 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
132 | .for_reclaim = 0, | 132 | .for_reclaim = 0, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | if (inode->i_sb->s_flags & MS_RDONLY) | ||
136 | return 0; | ||
137 | |||
135 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 138 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
136 | if (ret) | 139 | if (ret) |
137 | return ret; | 140 | return ret; |
138 | 141 | ||
139 | mutex_lock(&inode->i_mutex); | 142 | mutex_lock(&inode->i_mutex); |
140 | 143 | ||
141 | if (inode->i_sb->s_flags & MS_RDONLY) | ||
142 | goto out; | ||
143 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) | 144 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) |
144 | goto out; | 145 | goto out; |
145 | 146 | ||