diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 21:05:08 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 21:54:26 -0500 |
commit | e3154e9748f0f337e9f6ff9dc7d7bf24d426bd1a (patch) | |
tree | ac2a3f3dca6189b8a608571c49da66386fd1bdec /fs | |
parent | f7545144c2e3d280139260df934043e0a6ccce6f (diff) |
nilfs2: get rid of nilfs_sb_info structure
This directly uses sb->s_fs_info to keep a nilfs filesystem object and
fully removes the intermediate nilfs_sb_info structure. With this
change, the hierarchy of on-memory structures of nilfs will be
simplified as follows:
Before:
super_block
-> nilfs_sb_info
-> the_nilfs
-> cptree --+-> nilfs_root (current file system)
+-> nilfs_root (snapshot A)
+-> nilfs_root (snapshot B)
:
-> nilfs_sc_info (log writer structure)
After:
super_block
-> the_nilfs
-> cptree --+-> nilfs_root (current file system)
+-> nilfs_root (snapshot A)
+-> nilfs_root (snapshot B)
:
-> nilfs_sc_info (log writer structure)
The reason why we didn't design so from the beginning is because the
initial shape also differed from the above. The early hierachy was
composed of "per-mount-point" super_block -> nilfs_sb_info pairs and a
shared nilfs object. On the kernel 2.6.37, it was changed to the
current shape in order to unify super block instances into one per
device, and this cleanup became applicable as the result.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/bmap.c | 1 | ||||
-rw-r--r-- | fs/nilfs2/file.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/inode.c | 10 | ||||
-rw-r--r-- | fs/nilfs2/ioctl.c | 23 | ||||
-rw-r--r-- | fs/nilfs2/mdt.h | 2 | ||||
-rw-r--r-- | fs/nilfs2/namei.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/nilfs.h | 3 | ||||
-rw-r--r-- | fs/nilfs2/sb.h | 46 | ||||
-rw-r--r-- | fs/nilfs2/segment.c | 47 | ||||
-rw-r--r-- | fs/nilfs2/segment.h | 2 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 63 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.h | 1 |
12 files changed, 68 insertions, 134 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 85447a2fab33..4723f04e9b12 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include "nilfs.h" | 26 | #include "nilfs.h" |
27 | #include "bmap.h" | 27 | #include "bmap.h" |
28 | #include "sb.h" | ||
29 | #include "btree.h" | 28 | #include "btree.h" |
30 | #include "direct.h" | 29 | #include "direct.h" |
31 | #include "btnode.h" | 30 | #include "btnode.h" |
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index 7a5e4ab15c6e..93589fccdd97 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
@@ -59,7 +59,7 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
59 | struct nilfs_transaction_info ti; | 59 | struct nilfs_transaction_info ti; |
60 | int ret; | 60 | int ret; |
61 | 61 | ||
62 | if (unlikely(nilfs_near_disk_full(NILFS_SB(inode->i_sb)->s_nilfs))) | 62 | if (unlikely(nilfs_near_disk_full(inode->i_sb->s_fs_info))) |
63 | return VM_FAULT_SIGBUS; /* -ENOSPC */ | 63 | return VM_FAULT_SIGBUS; /* -ENOSPC */ |
64 | 64 | ||
65 | lock_page(page); | 65 | lock_page(page); |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 7a3dbe4f229c..d5625be236a8 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -295,7 +295,7 @@ const struct address_space_operations nilfs_aops = { | |||
295 | struct inode *nilfs_new_inode(struct inode *dir, int mode) | 295 | struct inode *nilfs_new_inode(struct inode *dir, int mode) |
296 | { | 296 | { |
297 | struct super_block *sb = dir->i_sb; | 297 | struct super_block *sb = dir->i_sb; |
298 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 298 | struct the_nilfs *nilfs = sb->s_fs_info; |
299 | struct inode *inode; | 299 | struct inode *inode; |
300 | struct nilfs_inode_info *ii; | 300 | struct nilfs_inode_info *ii; |
301 | struct nilfs_root *root; | 301 | struct nilfs_root *root; |
@@ -433,7 +433,7 @@ static int __nilfs_read_inode(struct super_block *sb, | |||
433 | struct nilfs_root *root, unsigned long ino, | 433 | struct nilfs_root *root, unsigned long ino, |
434 | struct inode *inode) | 434 | struct inode *inode) |
435 | { | 435 | { |
436 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 436 | struct the_nilfs *nilfs = sb->s_fs_info; |
437 | struct buffer_head *bh; | 437 | struct buffer_head *bh; |
438 | struct nilfs_inode *raw_inode; | 438 | struct nilfs_inode *raw_inode; |
439 | int err; | 439 | int err; |
@@ -807,7 +807,7 @@ int nilfs_permission(struct inode *inode, int mask, unsigned int flags) | |||
807 | 807 | ||
808 | int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) | 808 | int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) |
809 | { | 809 | { |
810 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 810 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
811 | struct nilfs_inode_info *ii = NILFS_I(inode); | 811 | struct nilfs_inode_info *ii = NILFS_I(inode); |
812 | int err; | 812 | int err; |
813 | 813 | ||
@@ -836,7 +836,7 @@ int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) | |||
836 | int nilfs_inode_dirty(struct inode *inode) | 836 | int nilfs_inode_dirty(struct inode *inode) |
837 | { | 837 | { |
838 | struct nilfs_inode_info *ii = NILFS_I(inode); | 838 | struct nilfs_inode_info *ii = NILFS_I(inode); |
839 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 839 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
840 | int ret = 0; | 840 | int ret = 0; |
841 | 841 | ||
842 | if (!list_empty(&ii->i_dirty)) { | 842 | if (!list_empty(&ii->i_dirty)) { |
@@ -851,7 +851,7 @@ int nilfs_inode_dirty(struct inode *inode) | |||
851 | int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty) | 851 | int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty) |
852 | { | 852 | { |
853 | struct nilfs_inode_info *ii = NILFS_I(inode); | 853 | struct nilfs_inode_info *ii = NILFS_I(inode); |
854 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 854 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
855 | 855 | ||
856 | atomic_add(nr_dirty, &nilfs->ns_ndirtyblks); | 856 | atomic_add(nr_dirty, &nilfs->ns_ndirtyblks); |
857 | 857 | ||
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 5471eed5eccb..95c04c2f2b3e 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -166,8 +166,7 @@ static int nilfs_ioctl_getversion(struct inode *inode, void __user *argp) | |||
166 | static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, | 166 | static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, |
167 | unsigned int cmd, void __user *argp) | 167 | unsigned int cmd, void __user *argp) |
168 | { | 168 | { |
169 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 169 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
170 | struct inode *cpfile = nilfs->ns_cpfile; | ||
171 | struct nilfs_transaction_info ti; | 170 | struct nilfs_transaction_info ti; |
172 | struct nilfs_cpmode cpmode; | 171 | struct nilfs_cpmode cpmode; |
173 | int ret; | 172 | int ret; |
@@ -187,7 +186,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, | |||
187 | 186 | ||
188 | nilfs_transaction_begin(inode->i_sb, &ti, 0); | 187 | nilfs_transaction_begin(inode->i_sb, &ti, 0); |
189 | ret = nilfs_cpfile_change_cpmode( | 188 | ret = nilfs_cpfile_change_cpmode( |
190 | cpfile, cpmode.cm_cno, cpmode.cm_mode); | 189 | nilfs->ns_cpfile, cpmode.cm_cno, cpmode.cm_mode); |
191 | if (unlikely(ret < 0)) | 190 | if (unlikely(ret < 0)) |
192 | nilfs_transaction_abort(inode->i_sb); | 191 | nilfs_transaction_abort(inode->i_sb); |
193 | else | 192 | else |
@@ -203,7 +202,7 @@ static int | |||
203 | nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp, | 202 | nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp, |
204 | unsigned int cmd, void __user *argp) | 203 | unsigned int cmd, void __user *argp) |
205 | { | 204 | { |
206 | struct inode *cpfile = NILFS_SB(inode->i_sb)->s_nilfs->ns_cpfile; | 205 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
207 | struct nilfs_transaction_info ti; | 206 | struct nilfs_transaction_info ti; |
208 | __u64 cno; | 207 | __u64 cno; |
209 | int ret; | 208 | int ret; |
@@ -220,7 +219,7 @@ nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp, | |||
220 | goto out; | 219 | goto out; |
221 | 220 | ||
222 | nilfs_transaction_begin(inode->i_sb, &ti, 0); | 221 | nilfs_transaction_begin(inode->i_sb, &ti, 0); |
223 | ret = nilfs_cpfile_delete_checkpoint(cpfile, cno); | 222 | ret = nilfs_cpfile_delete_checkpoint(nilfs->ns_cpfile, cno); |
224 | if (unlikely(ret < 0)) | 223 | if (unlikely(ret < 0)) |
225 | nilfs_transaction_abort(inode->i_sb); | 224 | nilfs_transaction_abort(inode->i_sb); |
226 | else | 225 | else |
@@ -246,7 +245,7 @@ nilfs_ioctl_do_get_cpinfo(struct the_nilfs *nilfs, __u64 *posp, int flags, | |||
246 | static int nilfs_ioctl_get_cpstat(struct inode *inode, struct file *filp, | 245 | static int nilfs_ioctl_get_cpstat(struct inode *inode, struct file *filp, |
247 | unsigned int cmd, void __user *argp) | 246 | unsigned int cmd, void __user *argp) |
248 | { | 247 | { |
249 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 248 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
250 | struct nilfs_cpstat cpstat; | 249 | struct nilfs_cpstat cpstat; |
251 | int ret; | 250 | int ret; |
252 | 251 | ||
@@ -277,7 +276,7 @@ nilfs_ioctl_do_get_suinfo(struct the_nilfs *nilfs, __u64 *posp, int flags, | |||
277 | static int nilfs_ioctl_get_sustat(struct inode *inode, struct file *filp, | 276 | static int nilfs_ioctl_get_sustat(struct inode *inode, struct file *filp, |
278 | unsigned int cmd, void __user *argp) | 277 | unsigned int cmd, void __user *argp) |
279 | { | 278 | { |
280 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 279 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
281 | struct nilfs_sustat sustat; | 280 | struct nilfs_sustat sustat; |
282 | int ret; | 281 | int ret; |
283 | 282 | ||
@@ -333,7 +332,7 @@ nilfs_ioctl_do_get_bdescs(struct the_nilfs *nilfs, __u64 *posp, int flags, | |||
333 | static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp, | 332 | static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp, |
334 | unsigned int cmd, void __user *argp) | 333 | unsigned int cmd, void __user *argp) |
335 | { | 334 | { |
336 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 335 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
337 | struct nilfs_argv argv; | 336 | struct nilfs_argv argv; |
338 | int ret; | 337 | int ret; |
339 | 338 | ||
@@ -402,7 +401,7 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb, | |||
402 | struct nilfs_argv *argv, void *buf) | 401 | struct nilfs_argv *argv, void *buf) |
403 | { | 402 | { |
404 | size_t nmembs = argv->v_nmembs; | 403 | size_t nmembs = argv->v_nmembs; |
405 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 404 | struct the_nilfs *nilfs = sb->s_fs_info; |
406 | struct inode *inode; | 405 | struct inode *inode; |
407 | struct nilfs_vdesc *vdesc; | 406 | struct nilfs_vdesc *vdesc; |
408 | struct buffer_head *bh, *n; | 407 | struct buffer_head *bh, *n; |
@@ -616,7 +615,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, | |||
616 | ret = PTR_ERR(kbufs[4]); | 615 | ret = PTR_ERR(kbufs[4]); |
617 | goto out; | 616 | goto out; |
618 | } | 617 | } |
619 | nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 618 | nilfs = inode->i_sb->s_fs_info; |
620 | 619 | ||
621 | for (n = 0; n < 4; n++) { | 620 | for (n = 0; n < 4; n++) { |
622 | ret = -EINVAL; | 621 | ret = -EINVAL; |
@@ -689,7 +688,7 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp, | |||
689 | return ret; | 688 | return ret; |
690 | 689 | ||
691 | if (argp != NULL) { | 690 | if (argp != NULL) { |
692 | nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 691 | nilfs = inode->i_sb->s_fs_info; |
693 | down_read(&nilfs->ns_segctor_sem); | 692 | down_read(&nilfs->ns_segctor_sem); |
694 | cno = nilfs->ns_cno - 1; | 693 | cno = nilfs->ns_cno - 1; |
695 | up_read(&nilfs->ns_segctor_sem); | 694 | up_read(&nilfs->ns_segctor_sem); |
@@ -707,7 +706,7 @@ static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp, | |||
707 | void *, size_t, size_t)) | 706 | void *, size_t, size_t)) |
708 | 707 | ||
709 | { | 708 | { |
710 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | 709 | struct the_nilfs *nilfs = inode->i_sb->s_fs_info; |
711 | struct nilfs_argv argv; | 710 | struct nilfs_argv argv; |
712 | int ret; | 711 | int ret; |
713 | 712 | ||
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h index b13734bf3521..ed68563ec708 100644 --- a/fs/nilfs2/mdt.h +++ b/fs/nilfs2/mdt.h | |||
@@ -66,7 +66,7 @@ static inline struct nilfs_mdt_info *NILFS_MDT(const struct inode *inode) | |||
66 | 66 | ||
67 | static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode) | 67 | static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode) |
68 | { | 68 | { |
69 | return NILFS_SB(inode->i_sb)->s_nilfs; | 69 | return inode->i_sb->s_fs_info; |
70 | } | 70 | } |
71 | 71 | ||
72 | /* Default GFP flags using highmem */ | 72 | /* Default GFP flags using highmem */ |
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 161791d26458..546849b3e88f 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -482,7 +482,7 @@ static struct dentry *nilfs_get_dentry(struct super_block *sb, u64 cno, | |||
482 | if (ino < NILFS_FIRST_INO(sb) && ino != NILFS_ROOT_INO) | 482 | if (ino < NILFS_FIRST_INO(sb) && ino != NILFS_ROOT_INO) |
483 | return ERR_PTR(-ESTALE); | 483 | return ERR_PTR(-ESTALE); |
484 | 484 | ||
485 | root = nilfs_lookup_root(NILFS_SB(sb)->s_nilfs, cno); | 485 | root = nilfs_lookup_root(sb->s_fs_info, cno); |
486 | if (!root) | 486 | if (!root) |
487 | return ERR_PTR(-ESTALE); | 487 | return ERR_PTR(-ESTALE); |
488 | 488 | ||
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index eba1aaa7fb7b..856e8e4e0b74 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
31 | #include <linux/nilfs2_fs.h> | 31 | #include <linux/nilfs2_fs.h> |
32 | #include "the_nilfs.h" | 32 | #include "the_nilfs.h" |
33 | #include "sb.h" | ||
34 | #include "bmap.h" | 33 | #include "bmap.h" |
35 | 34 | ||
36 | /* | 35 | /* |
@@ -122,7 +121,7 @@ enum { | |||
122 | #define NILFS_SYS_INO_BITS \ | 121 | #define NILFS_SYS_INO_BITS \ |
123 | ((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS) | 122 | ((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS) |
124 | 123 | ||
125 | #define NILFS_FIRST_INO(sb) (NILFS_SB(sb)->s_nilfs->ns_first_ino) | 124 | #define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino) |
126 | 125 | ||
127 | #define NILFS_MDT_INODE(sb, ino) \ | 126 | #define NILFS_MDT_INODE(sb, ino) \ |
128 | ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino)))) | 127 | ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino)))) |
diff --git a/fs/nilfs2/sb.h b/fs/nilfs2/sb.h deleted file mode 100644 index 44553f42ebac..000000000000 --- a/fs/nilfs2/sb.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * sb.h - NILFS on-memory super block structure. | ||
3 | * | ||
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | * | ||
20 | * Written by Ryusuke Konishi <ryusuke@osrg.net> | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _NILFS_SB | ||
25 | #define _NILFS_SB | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/fs.h> | ||
29 | |||
30 | struct the_nilfs; | ||
31 | |||
32 | /* | ||
33 | * NILFS super-block data in memory | ||
34 | */ | ||
35 | struct nilfs_sb_info { | ||
36 | /* Fundamental members */ | ||
37 | struct super_block *s_super; /* reverse pointer to super_block */ | ||
38 | struct the_nilfs *s_nilfs; | ||
39 | }; | ||
40 | |||
41 | static inline struct nilfs_sb_info *NILFS_SB(struct super_block *sb) | ||
42 | { | ||
43 | return sb->s_fs_info; | ||
44 | } | ||
45 | |||
46 | #endif /* _NILFS_SB */ | ||
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 90e3130303a3..afe4f2183454 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -191,7 +191,7 @@ int nilfs_transaction_begin(struct super_block *sb, | |||
191 | 191 | ||
192 | vfs_check_frozen(sb, SB_FREEZE_WRITE); | 192 | vfs_check_frozen(sb, SB_FREEZE_WRITE); |
193 | 193 | ||
194 | nilfs = NILFS_SB(sb)->s_nilfs; | 194 | nilfs = sb->s_fs_info; |
195 | down_read(&nilfs->ns_segctor_sem); | 195 | down_read(&nilfs->ns_segctor_sem); |
196 | if (vacancy_check && nilfs_near_disk_full(nilfs)) { | 196 | if (vacancy_check && nilfs_near_disk_full(nilfs)) { |
197 | up_read(&nilfs->ns_segctor_sem); | 197 | up_read(&nilfs->ns_segctor_sem); |
@@ -222,7 +222,7 @@ int nilfs_transaction_begin(struct super_block *sb, | |||
222 | int nilfs_transaction_commit(struct super_block *sb) | 222 | int nilfs_transaction_commit(struct super_block *sb) |
223 | { | 223 | { |
224 | struct nilfs_transaction_info *ti = current->journal_info; | 224 | struct nilfs_transaction_info *ti = current->journal_info; |
225 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 225 | struct the_nilfs *nilfs = sb->s_fs_info; |
226 | int err = 0; | 226 | int err = 0; |
227 | 227 | ||
228 | BUG_ON(ti == NULL || ti->ti_magic != NILFS_TI_MAGIC); | 228 | BUG_ON(ti == NULL || ti->ti_magic != NILFS_TI_MAGIC); |
@@ -252,13 +252,14 @@ int nilfs_transaction_commit(struct super_block *sb) | |||
252 | void nilfs_transaction_abort(struct super_block *sb) | 252 | void nilfs_transaction_abort(struct super_block *sb) |
253 | { | 253 | { |
254 | struct nilfs_transaction_info *ti = current->journal_info; | 254 | struct nilfs_transaction_info *ti = current->journal_info; |
255 | struct the_nilfs *nilfs = sb->s_fs_info; | ||
255 | 256 | ||
256 | BUG_ON(ti == NULL || ti->ti_magic != NILFS_TI_MAGIC); | 257 | BUG_ON(ti == NULL || ti->ti_magic != NILFS_TI_MAGIC); |
257 | if (ti->ti_count > 0) { | 258 | if (ti->ti_count > 0) { |
258 | ti->ti_count--; | 259 | ti->ti_count--; |
259 | return; | 260 | return; |
260 | } | 261 | } |
261 | up_read(&NILFS_SB(sb)->s_nilfs->ns_segctor_sem); | 262 | up_read(&nilfs->ns_segctor_sem); |
262 | 263 | ||
263 | current->journal_info = ti->ti_save; | 264 | current->journal_info = ti->ti_save; |
264 | if (ti->ti_flags & NILFS_TI_DYNAMIC_ALLOC) | 265 | if (ti->ti_flags & NILFS_TI_DYNAMIC_ALLOC) |
@@ -267,7 +268,7 @@ void nilfs_transaction_abort(struct super_block *sb) | |||
267 | 268 | ||
268 | void nilfs_relax_pressure_in_lock(struct super_block *sb) | 269 | void nilfs_relax_pressure_in_lock(struct super_block *sb) |
269 | { | 270 | { |
270 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 271 | struct the_nilfs *nilfs = sb->s_fs_info; |
271 | struct nilfs_sc_info *sci = nilfs->ns_writer; | 272 | struct nilfs_sc_info *sci = nilfs->ns_writer; |
272 | 273 | ||
273 | if (!sci || !sci->sc_flush_request) | 274 | if (!sci || !sci->sc_flush_request) |
@@ -293,7 +294,7 @@ static void nilfs_transaction_lock(struct super_block *sb, | |||
293 | int gcflag) | 294 | int gcflag) |
294 | { | 295 | { |
295 | struct nilfs_transaction_info *cur_ti = current->journal_info; | 296 | struct nilfs_transaction_info *cur_ti = current->journal_info; |
296 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 297 | struct the_nilfs *nilfs = sb->s_fs_info; |
297 | struct nilfs_sc_info *sci = nilfs->ns_writer; | 298 | struct nilfs_sc_info *sci = nilfs->ns_writer; |
298 | 299 | ||
299 | WARN_ON(cur_ti); | 300 | WARN_ON(cur_ti); |
@@ -321,7 +322,7 @@ static void nilfs_transaction_lock(struct super_block *sb, | |||
321 | static void nilfs_transaction_unlock(struct super_block *sb) | 322 | static void nilfs_transaction_unlock(struct super_block *sb) |
322 | { | 323 | { |
323 | struct nilfs_transaction_info *ti = current->journal_info; | 324 | struct nilfs_transaction_info *ti = current->journal_info; |
324 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 325 | struct the_nilfs *nilfs = sb->s_fs_info; |
325 | 326 | ||
326 | BUG_ON(ti == NULL || ti->ti_magic != NILFS_TI_MAGIC); | 327 | BUG_ON(ti == NULL || ti->ti_magic != NILFS_TI_MAGIC); |
327 | BUG_ON(ti->ti_count > 0); | 328 | BUG_ON(ti->ti_count > 0); |
@@ -770,7 +771,7 @@ static int nilfs_segctor_clean(struct nilfs_sc_info *sci) | |||
770 | 771 | ||
771 | static int nilfs_segctor_confirm(struct nilfs_sc_info *sci) | 772 | static int nilfs_segctor_confirm(struct nilfs_sc_info *sci) |
772 | { | 773 | { |
773 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 774 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
774 | int ret = 0; | 775 | int ret = 0; |
775 | 776 | ||
776 | if (nilfs_test_metadata_dirty(nilfs, sci->sc_root)) | 777 | if (nilfs_test_metadata_dirty(nilfs, sci->sc_root)) |
@@ -786,7 +787,7 @@ static int nilfs_segctor_confirm(struct nilfs_sc_info *sci) | |||
786 | 787 | ||
787 | static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci) | 788 | static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci) |
788 | { | 789 | { |
789 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 790 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
790 | 791 | ||
791 | nilfs_mdt_clear_dirty(sci->sc_root->ifile); | 792 | nilfs_mdt_clear_dirty(sci->sc_root->ifile); |
792 | nilfs_mdt_clear_dirty(nilfs->ns_cpfile); | 793 | nilfs_mdt_clear_dirty(nilfs->ns_cpfile); |
@@ -796,7 +797,7 @@ static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci) | |||
796 | 797 | ||
797 | static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci) | 798 | static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci) |
798 | { | 799 | { |
799 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 800 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
800 | struct buffer_head *bh_cp; | 801 | struct buffer_head *bh_cp; |
801 | struct nilfs_checkpoint *raw_cp; | 802 | struct nilfs_checkpoint *raw_cp; |
802 | int err; | 803 | int err; |
@@ -820,7 +821,7 @@ static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci) | |||
820 | 821 | ||
821 | static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) | 822 | static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) |
822 | { | 823 | { |
823 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 824 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
824 | struct buffer_head *bh_cp; | 825 | struct buffer_head *bh_cp; |
825 | struct nilfs_checkpoint *raw_cp; | 826 | struct nilfs_checkpoint *raw_cp; |
826 | int err; | 827 | int err; |
@@ -1044,7 +1045,7 @@ static int nilfs_segctor_scan_file_dsync(struct nilfs_sc_info *sci, | |||
1044 | 1045 | ||
1045 | static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode) | 1046 | static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode) |
1046 | { | 1047 | { |
1047 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 1048 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
1048 | struct list_head *head; | 1049 | struct list_head *head; |
1049 | struct nilfs_inode_info *ii; | 1050 | struct nilfs_inode_info *ii; |
1050 | size_t ndone; | 1051 | size_t ndone; |
@@ -1853,7 +1854,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
1853 | { | 1854 | { |
1854 | struct nilfs_segment_buffer *segbuf; | 1855 | struct nilfs_segment_buffer *segbuf; |
1855 | struct page *bd_page = NULL, *fs_page = NULL; | 1856 | struct page *bd_page = NULL, *fs_page = NULL; |
1856 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 1857 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
1857 | int update_sr = false; | 1858 | int update_sr = false; |
1858 | 1859 | ||
1859 | list_for_each_entry(segbuf, &sci->sc_write_logs, sb_list) { | 1860 | list_for_each_entry(segbuf, &sci->sc_write_logs, sb_list) { |
@@ -2024,7 +2025,7 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, | |||
2024 | */ | 2025 | */ |
2025 | static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode) | 2026 | static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode) |
2026 | { | 2027 | { |
2027 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 2028 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
2028 | struct page *failed_page; | 2029 | struct page *failed_page; |
2029 | int err; | 2030 | int err; |
2030 | 2031 | ||
@@ -2162,7 +2163,7 @@ static void nilfs_segctor_do_flush(struct nilfs_sc_info *sci, int bn) | |||
2162 | */ | 2163 | */ |
2163 | void nilfs_flush_segment(struct super_block *sb, ino_t ino) | 2164 | void nilfs_flush_segment(struct super_block *sb, ino_t ino) |
2164 | { | 2165 | { |
2165 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2166 | struct the_nilfs *nilfs = sb->s_fs_info; |
2166 | struct nilfs_sc_info *sci = nilfs->ns_writer; | 2167 | struct nilfs_sc_info *sci = nilfs->ns_writer; |
2167 | 2168 | ||
2168 | if (!sci || nilfs_doing_construction()) | 2169 | if (!sci || nilfs_doing_construction()) |
@@ -2252,7 +2253,7 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err) | |||
2252 | */ | 2253 | */ |
2253 | int nilfs_construct_segment(struct super_block *sb) | 2254 | int nilfs_construct_segment(struct super_block *sb) |
2254 | { | 2255 | { |
2255 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2256 | struct the_nilfs *nilfs = sb->s_fs_info; |
2256 | struct nilfs_sc_info *sci = nilfs->ns_writer; | 2257 | struct nilfs_sc_info *sci = nilfs->ns_writer; |
2257 | struct nilfs_transaction_info *ti; | 2258 | struct nilfs_transaction_info *ti; |
2258 | int err; | 2259 | int err; |
@@ -2290,7 +2291,7 @@ int nilfs_construct_segment(struct super_block *sb) | |||
2290 | int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, | 2291 | int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, |
2291 | loff_t start, loff_t end) | 2292 | loff_t start, loff_t end) |
2292 | { | 2293 | { |
2293 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2294 | struct the_nilfs *nilfs = sb->s_fs_info; |
2294 | struct nilfs_sc_info *sci = nilfs->ns_writer; | 2295 | struct nilfs_sc_info *sci = nilfs->ns_writer; |
2295 | struct nilfs_inode_info *ii; | 2296 | struct nilfs_inode_info *ii; |
2296 | struct nilfs_transaction_info ti; | 2297 | struct nilfs_transaction_info ti; |
@@ -2381,7 +2382,7 @@ static void nilfs_segctor_notify(struct nilfs_sc_info *sci, int mode, int err) | |||
2381 | */ | 2382 | */ |
2382 | static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode) | 2383 | static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode) |
2383 | { | 2384 | { |
2384 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 2385 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
2385 | struct nilfs_super_block **sbp; | 2386 | struct nilfs_super_block **sbp; |
2386 | int err = 0; | 2387 | int err = 0; |
2387 | 2388 | ||
@@ -2436,7 +2437,7 @@ nilfs_remove_written_gcinodes(struct the_nilfs *nilfs, struct list_head *head) | |||
2436 | int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv, | 2437 | int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv, |
2437 | void **kbufs) | 2438 | void **kbufs) |
2438 | { | 2439 | { |
2439 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2440 | struct the_nilfs *nilfs = sb->s_fs_info; |
2440 | struct nilfs_sc_info *sci = nilfs->ns_writer; | 2441 | struct nilfs_sc_info *sci = nilfs->ns_writer; |
2441 | struct nilfs_transaction_info ti; | 2442 | struct nilfs_transaction_info ti; |
2442 | int err; | 2443 | int err; |
@@ -2552,7 +2553,7 @@ static int nilfs_segctor_flush_mode(struct nilfs_sc_info *sci) | |||
2552 | static int nilfs_segctor_thread(void *arg) | 2553 | static int nilfs_segctor_thread(void *arg) |
2553 | { | 2554 | { |
2554 | struct nilfs_sc_info *sci = (struct nilfs_sc_info *)arg; | 2555 | struct nilfs_sc_info *sci = (struct nilfs_sc_info *)arg; |
2555 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 2556 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
2556 | int timeout = 0; | 2557 | int timeout = 0; |
2557 | 2558 | ||
2558 | sci->sc_timer.data = (unsigned long)current; | 2559 | sci->sc_timer.data = (unsigned long)current; |
@@ -2666,7 +2667,7 @@ static void nilfs_segctor_kill_thread(struct nilfs_sc_info *sci) | |||
2666 | static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb, | 2667 | static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb, |
2667 | struct nilfs_root *root) | 2668 | struct nilfs_root *root) |
2668 | { | 2669 | { |
2669 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2670 | struct the_nilfs *nilfs = sb->s_fs_info; |
2670 | struct nilfs_sc_info *sci; | 2671 | struct nilfs_sc_info *sci; |
2671 | 2672 | ||
2672 | sci = kzalloc(sizeof(*sci), GFP_KERNEL); | 2673 | sci = kzalloc(sizeof(*sci), GFP_KERNEL); |
@@ -2726,7 +2727,7 @@ static void nilfs_segctor_write_out(struct nilfs_sc_info *sci) | |||
2726 | */ | 2727 | */ |
2727 | static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) | 2728 | static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) |
2728 | { | 2729 | { |
2729 | struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs; | 2730 | struct the_nilfs *nilfs = sci->sc_super->s_fs_info; |
2730 | int flag; | 2731 | int flag; |
2731 | 2732 | ||
2732 | up_write(&nilfs->ns_segctor_sem); | 2733 | up_write(&nilfs->ns_segctor_sem); |
@@ -2774,7 +2775,7 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) | |||
2774 | */ | 2775 | */ |
2775 | int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root) | 2776 | int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root) |
2776 | { | 2777 | { |
2777 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2778 | struct the_nilfs *nilfs = sb->s_fs_info; |
2778 | int err; | 2779 | int err; |
2779 | 2780 | ||
2780 | if (nilfs->ns_writer) { | 2781 | if (nilfs->ns_writer) { |
@@ -2807,7 +2808,7 @@ int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root) | |||
2807 | */ | 2808 | */ |
2808 | void nilfs_detach_log_writer(struct super_block *sb) | 2809 | void nilfs_detach_log_writer(struct super_block *sb) |
2809 | { | 2810 | { |
2810 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 2811 | struct the_nilfs *nilfs = sb->s_fs_info; |
2811 | LIST_HEAD(garbage_list); | 2812 | LIST_HEAD(garbage_list); |
2812 | 2813 | ||
2813 | down_write(&nilfs->ns_segctor_sem); | 2814 | down_write(&nilfs->ns_segctor_sem); |
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h index e01998e33b31..6c02a86745fb 100644 --- a/fs/nilfs2/segment.h +++ b/fs/nilfs2/segment.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | #include <linux/nilfs2_fs.h> | 29 | #include <linux/nilfs2_fs.h> |
30 | #include "sb.h" | 30 | #include "nilfs.h" |
31 | 31 | ||
32 | struct nilfs_root; | 32 | struct nilfs_root; |
33 | 33 | ||
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index a8cbd695441e..062cca065195 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -76,7 +76,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data); | |||
76 | 76 | ||
77 | static void nilfs_set_error(struct super_block *sb) | 77 | static void nilfs_set_error(struct super_block *sb) |
78 | { | 78 | { |
79 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 79 | struct the_nilfs *nilfs = sb->s_fs_info; |
80 | struct nilfs_super_block **sbp; | 80 | struct nilfs_super_block **sbp; |
81 | 81 | ||
82 | down_write(&nilfs->ns_sem); | 82 | down_write(&nilfs->ns_sem); |
@@ -108,7 +108,7 @@ static void nilfs_set_error(struct super_block *sb) | |||
108 | void nilfs_error(struct super_block *sb, const char *function, | 108 | void nilfs_error(struct super_block *sb, const char *function, |
109 | const char *fmt, ...) | 109 | const char *fmt, ...) |
110 | { | 110 | { |
111 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 111 | struct the_nilfs *nilfs = sb->s_fs_info; |
112 | struct va_format vaf; | 112 | struct va_format vaf; |
113 | va_list args; | 113 | va_list args; |
114 | 114 | ||
@@ -190,7 +190,7 @@ void nilfs_destroy_inode(struct inode *inode) | |||
190 | 190 | ||
191 | static int nilfs_sync_super(struct super_block *sb, int flag) | 191 | static int nilfs_sync_super(struct super_block *sb, int flag) |
192 | { | 192 | { |
193 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 193 | struct the_nilfs *nilfs = sb->s_fs_info; |
194 | int err; | 194 | int err; |
195 | 195 | ||
196 | retry: | 196 | retry: |
@@ -265,7 +265,7 @@ void nilfs_set_log_cursor(struct nilfs_super_block *sbp, | |||
265 | struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb, | 265 | struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb, |
266 | int flip) | 266 | int flip) |
267 | { | 267 | { |
268 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 268 | struct the_nilfs *nilfs = sb->s_fs_info; |
269 | struct nilfs_super_block **sbp = nilfs->ns_sbp; | 269 | struct nilfs_super_block **sbp = nilfs->ns_sbp; |
270 | 270 | ||
271 | /* nilfs->ns_sem must be locked by the caller. */ | 271 | /* nilfs->ns_sem must be locked by the caller. */ |
@@ -291,7 +291,7 @@ struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb, | |||
291 | 291 | ||
292 | int nilfs_commit_super(struct super_block *sb, int flag) | 292 | int nilfs_commit_super(struct super_block *sb, int flag) |
293 | { | 293 | { |
294 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 294 | struct the_nilfs *nilfs = sb->s_fs_info; |
295 | struct nilfs_super_block **sbp = nilfs->ns_sbp; | 295 | struct nilfs_super_block **sbp = nilfs->ns_sbp; |
296 | time_t t; | 296 | time_t t; |
297 | 297 | ||
@@ -324,7 +324,7 @@ int nilfs_commit_super(struct super_block *sb, int flag) | |||
324 | */ | 324 | */ |
325 | int nilfs_cleanup_super(struct super_block *sb) | 325 | int nilfs_cleanup_super(struct super_block *sb) |
326 | { | 326 | { |
327 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 327 | struct the_nilfs *nilfs = sb->s_fs_info; |
328 | struct nilfs_super_block **sbp; | 328 | struct nilfs_super_block **sbp; |
329 | int flag = NILFS_SB_COMMIT; | 329 | int flag = NILFS_SB_COMMIT; |
330 | int ret = -EIO; | 330 | int ret = -EIO; |
@@ -349,8 +349,7 @@ int nilfs_cleanup_super(struct super_block *sb) | |||
349 | 349 | ||
350 | static void nilfs_put_super(struct super_block *sb) | 350 | static void nilfs_put_super(struct super_block *sb) |
351 | { | 351 | { |
352 | struct nilfs_sb_info *sbi = NILFS_SB(sb); | 352 | struct the_nilfs *nilfs = sb->s_fs_info; |
353 | struct the_nilfs *nilfs = sbi->s_nilfs; | ||
354 | 353 | ||
355 | nilfs_detach_log_writer(sb); | 354 | nilfs_detach_log_writer(sb); |
356 | 355 | ||
@@ -365,14 +364,12 @@ static void nilfs_put_super(struct super_block *sb) | |||
365 | iput(nilfs->ns_dat); | 364 | iput(nilfs->ns_dat); |
366 | 365 | ||
367 | destroy_nilfs(nilfs); | 366 | destroy_nilfs(nilfs); |
368 | sbi->s_super = NULL; | ||
369 | sb->s_fs_info = NULL; | 367 | sb->s_fs_info = NULL; |
370 | kfree(sbi); | ||
371 | } | 368 | } |
372 | 369 | ||
373 | static int nilfs_sync_fs(struct super_block *sb, int wait) | 370 | static int nilfs_sync_fs(struct super_block *sb, int wait) |
374 | { | 371 | { |
375 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 372 | struct the_nilfs *nilfs = sb->s_fs_info; |
376 | struct nilfs_super_block **sbp; | 373 | struct nilfs_super_block **sbp; |
377 | int err = 0; | 374 | int err = 0; |
378 | 375 | ||
@@ -396,7 +393,7 @@ static int nilfs_sync_fs(struct super_block *sb, int wait) | |||
396 | int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, | 393 | int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, |
397 | struct nilfs_root **rootp) | 394 | struct nilfs_root **rootp) |
398 | { | 395 | { |
399 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 396 | struct the_nilfs *nilfs = sb->s_fs_info; |
400 | struct nilfs_root *root; | 397 | struct nilfs_root *root; |
401 | struct nilfs_checkpoint *raw_cp; | 398 | struct nilfs_checkpoint *raw_cp; |
402 | struct buffer_head *bh_cp; | 399 | struct buffer_head *bh_cp; |
@@ -449,7 +446,7 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, | |||
449 | 446 | ||
450 | static int nilfs_freeze(struct super_block *sb) | 447 | static int nilfs_freeze(struct super_block *sb) |
451 | { | 448 | { |
452 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 449 | struct the_nilfs *nilfs = sb->s_fs_info; |
453 | int err; | 450 | int err; |
454 | 451 | ||
455 | if (sb->s_flags & MS_RDONLY) | 452 | if (sb->s_flags & MS_RDONLY) |
@@ -464,7 +461,7 @@ static int nilfs_freeze(struct super_block *sb) | |||
464 | 461 | ||
465 | static int nilfs_unfreeze(struct super_block *sb) | 462 | static int nilfs_unfreeze(struct super_block *sb) |
466 | { | 463 | { |
467 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 464 | struct the_nilfs *nilfs = sb->s_fs_info; |
468 | 465 | ||
469 | if (sb->s_flags & MS_RDONLY) | 466 | if (sb->s_flags & MS_RDONLY) |
470 | return 0; | 467 | return 0; |
@@ -527,7 +524,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
527 | static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | 524 | static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs) |
528 | { | 525 | { |
529 | struct super_block *sb = vfs->mnt_sb; | 526 | struct super_block *sb = vfs->mnt_sb; |
530 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 527 | struct the_nilfs *nilfs = sb->s_fs_info; |
531 | struct nilfs_root *root = NILFS_I(vfs->mnt_root->d_inode)->i_root; | 528 | struct nilfs_root *root = NILFS_I(vfs->mnt_root->d_inode)->i_root; |
532 | 529 | ||
533 | if (!nilfs_test_opt(nilfs, BARRIER)) | 530 | if (!nilfs_test_opt(nilfs, BARRIER)) |
@@ -591,7 +588,7 @@ static match_table_t tokens = { | |||
591 | 588 | ||
592 | static int parse_options(char *options, struct super_block *sb, int is_remount) | 589 | static int parse_options(char *options, struct super_block *sb, int is_remount) |
593 | { | 590 | { |
594 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 591 | struct the_nilfs *nilfs = sb->s_fs_info; |
595 | char *p; | 592 | char *p; |
596 | substring_t args[MAX_OPT_ARGS]; | 593 | substring_t args[MAX_OPT_ARGS]; |
597 | 594 | ||
@@ -660,7 +657,7 @@ static inline void | |||
660 | nilfs_set_default_options(struct super_block *sb, | 657 | nilfs_set_default_options(struct super_block *sb, |
661 | struct nilfs_super_block *sbp) | 658 | struct nilfs_super_block *sbp) |
662 | { | 659 | { |
663 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 660 | struct the_nilfs *nilfs = sb->s_fs_info; |
664 | 661 | ||
665 | nilfs->ns_mount_opt = | 662 | nilfs->ns_mount_opt = |
666 | NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER; | 663 | NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER; |
@@ -668,7 +665,7 @@ nilfs_set_default_options(struct super_block *sb, | |||
668 | 665 | ||
669 | static int nilfs_setup_super(struct super_block *sb, int is_mount) | 666 | static int nilfs_setup_super(struct super_block *sb, int is_mount) |
670 | { | 667 | { |
671 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 668 | struct the_nilfs *nilfs = sb->s_fs_info; |
672 | struct nilfs_super_block **sbp; | 669 | struct nilfs_super_block **sbp; |
673 | int max_mnt_count; | 670 | int max_mnt_count; |
674 | int mnt_count; | 671 | int mnt_count; |
@@ -726,7 +723,7 @@ int nilfs_store_magic_and_option(struct super_block *sb, | |||
726 | struct nilfs_super_block *sbp, | 723 | struct nilfs_super_block *sbp, |
727 | char *data) | 724 | char *data) |
728 | { | 725 | { |
729 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 726 | struct the_nilfs *nilfs = sb->s_fs_info; |
730 | 727 | ||
731 | sb->s_magic = le16_to_cpu(sbp->s_magic); | 728 | sb->s_magic = le16_to_cpu(sbp->s_magic); |
732 | 729 | ||
@@ -821,7 +818,7 @@ static int nilfs_get_root_dentry(struct super_block *sb, | |||
821 | static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | 818 | static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, |
822 | struct dentry **root_dentry) | 819 | struct dentry **root_dentry) |
823 | { | 820 | { |
824 | struct the_nilfs *nilfs = NILFS_SB(s)->s_nilfs; | 821 | struct the_nilfs *nilfs = s->s_fs_info; |
825 | struct nilfs_root *root; | 822 | struct nilfs_root *root; |
826 | int ret; | 823 | int ret; |
827 | 824 | ||
@@ -873,7 +870,7 @@ static int nilfs_try_to_shrink_tree(struct dentry *root_dentry) | |||
873 | 870 | ||
874 | int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) | 871 | int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) |
875 | { | 872 | { |
876 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 873 | struct the_nilfs *nilfs = sb->s_fs_info; |
877 | struct nilfs_root *root; | 874 | struct nilfs_root *root; |
878 | struct inode *inode; | 875 | struct inode *inode; |
879 | struct dentry *dentry; | 876 | struct dentry *dentry; |
@@ -886,7 +883,7 @@ int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) | |||
886 | return true; /* protect recent checkpoints */ | 883 | return true; /* protect recent checkpoints */ |
887 | 884 | ||
888 | ret = false; | 885 | ret = false; |
889 | root = nilfs_lookup_root(NILFS_SB(sb)->s_nilfs, cno); | 886 | root = nilfs_lookup_root(nilfs, cno); |
890 | if (root) { | 887 | if (root) { |
891 | inode = nilfs_ilookup(sb, root, NILFS_ROOT_INO); | 888 | inode = nilfs_ilookup(sb, root, NILFS_ROOT_INO); |
892 | if (inode) { | 889 | if (inode) { |
@@ -916,25 +913,16 @@ static int | |||
916 | nilfs_fill_super(struct super_block *sb, void *data, int silent) | 913 | nilfs_fill_super(struct super_block *sb, void *data, int silent) |
917 | { | 914 | { |
918 | struct the_nilfs *nilfs; | 915 | struct the_nilfs *nilfs; |
919 | struct nilfs_sb_info *sbi; | ||
920 | struct nilfs_root *fsroot; | 916 | struct nilfs_root *fsroot; |
921 | struct backing_dev_info *bdi; | 917 | struct backing_dev_info *bdi; |
922 | __u64 cno; | 918 | __u64 cno; |
923 | int err; | 919 | int err; |
924 | 920 | ||
925 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 921 | nilfs = alloc_nilfs(sb->s_bdev); |
926 | if (!sbi) | 922 | if (!nilfs) |
927 | return -ENOMEM; | 923 | return -ENOMEM; |
928 | 924 | ||
929 | sb->s_fs_info = sbi; | 925 | sb->s_fs_info = nilfs; |
930 | sbi->s_super = sb; | ||
931 | |||
932 | nilfs = alloc_nilfs(sb->s_bdev); | ||
933 | if (!nilfs) { | ||
934 | err = -ENOMEM; | ||
935 | goto failed_sbi; | ||
936 | } | ||
937 | sbi->s_nilfs = nilfs; | ||
938 | 926 | ||
939 | err = init_nilfs(nilfs, sb, (char *)data); | 927 | err = init_nilfs(nilfs, sb, (char *)data); |
940 | if (err) | 928 | if (err) |
@@ -993,16 +981,12 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) | |||
993 | 981 | ||
994 | failed_nilfs: | 982 | failed_nilfs: |
995 | destroy_nilfs(nilfs); | 983 | destroy_nilfs(nilfs); |
996 | |||
997 | failed_sbi: | ||
998 | sb->s_fs_info = NULL; | ||
999 | kfree(sbi); | ||
1000 | return err; | 984 | return err; |
1001 | } | 985 | } |
1002 | 986 | ||
1003 | static int nilfs_remount(struct super_block *sb, int *flags, char *data) | 987 | static int nilfs_remount(struct super_block *sb, int *flags, char *data) |
1004 | { | 988 | { |
1005 | struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; | 989 | struct the_nilfs *nilfs = sb->s_fs_info; |
1006 | unsigned long old_sb_flags; | 990 | unsigned long old_sb_flags; |
1007 | unsigned long old_mount_opt; | 991 | unsigned long old_mount_opt; |
1008 | int err; | 992 | int err; |
@@ -1083,7 +1067,6 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) | |||
1083 | 1067 | ||
1084 | struct nilfs_super_data { | 1068 | struct nilfs_super_data { |
1085 | struct block_device *bdev; | 1069 | struct block_device *bdev; |
1086 | struct nilfs_sb_info *sbi; | ||
1087 | __u64 cno; | 1070 | __u64 cno; |
1088 | int flags; | 1071 | int flags; |
1089 | }; | 1072 | }; |
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index 793bd272f9e0..f4968145c2a3 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/blkdev.h> | 31 | #include <linux/blkdev.h> |
32 | #include <linux/backing-dev.h> | 32 | #include <linux/backing-dev.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include "sb.h" | ||
35 | 34 | ||
36 | struct nilfs_sc_info; | 35 | struct nilfs_sc_info; |
37 | 36 | ||