diff options
author | Changman Lee <cm224.lee@samsung.com> | 2013-01-29 04:30:07 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-02-11 17:15:00 -0500 |
commit | d6212a5f18c8f9f9cc884070a96e11907711217f (patch) | |
tree | d1c579ecdeb7c2ffc94bffbe0b51af4d2e3c49f3 /fs/f2fs/super.c | |
parent | a2617dc6863b21a8109c199ab533b3dbfe178f27 (diff) |
f2fs: add un/freeze_fs into super_operations
This patch supports ioctl FIFREEZE and FITHAW to snapshot filesystem.
Before calling f2fs_freeze, all writers would be suspended and sync_fs
would be completed. So no f2fs has to do something.
Just background gc operation should be skipped due to generate dirty
nodes and data until unfreeze.
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 25656b6869a4..0b18aee2ed25 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -143,6 +143,22 @@ int f2fs_sync_fs(struct super_block *sb, int sync) | |||
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | static int f2fs_freeze(struct super_block *sb) | ||
147 | { | ||
148 | int err; | ||
149 | |||
150 | if (sb->s_flags & MS_RDONLY) | ||
151 | return 0; | ||
152 | |||
153 | err = f2fs_sync_fs(sb, 1); | ||
154 | return err; | ||
155 | } | ||
156 | |||
157 | static int f2fs_unfreeze(struct super_block *sb) | ||
158 | { | ||
159 | return 0; | ||
160 | } | ||
161 | |||
146 | static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) | 162 | static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) |
147 | { | 163 | { |
148 | struct super_block *sb = dentry->d_sb; | 164 | struct super_block *sb = dentry->d_sb; |
@@ -213,6 +229,8 @@ static struct super_operations f2fs_sops = { | |||
213 | .evict_inode = f2fs_evict_inode, | 229 | .evict_inode = f2fs_evict_inode, |
214 | .put_super = f2fs_put_super, | 230 | .put_super = f2fs_put_super, |
215 | .sync_fs = f2fs_sync_fs, | 231 | .sync_fs = f2fs_sync_fs, |
232 | .freeze_fs = f2fs_freeze, | ||
233 | .unfreeze_fs = f2fs_unfreeze, | ||
216 | .statfs = f2fs_statfs, | 234 | .statfs = f2fs_statfs, |
217 | }; | 235 | }; |
218 | 236 | ||