diff options
| author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-10 07:52:09 -0400 |
|---|---|---|
| committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-22 21:02:14 -0400 |
| commit | 05d0e94b66dbdf9d90371b39dc7a6b390ba74d41 (patch) | |
| tree | 10476599c8102fc58f635d63e4e9a7aa58bf905e /fs/nilfs2 | |
| parent | dc935be2a094087bc561d80f8cf9e66bbc1f7b18 (diff) | |
nilfs2: get rid of nilfs_bmap_union
This removes nilfs_bmap_union and finally unifies three structures and
the union in bmap/btree code into one.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
| -rw-r--r-- | fs/nilfs2/bmap.c | 6 | ||||
| -rw-r--r-- | fs/nilfs2/bmap_union.h | 42 | ||||
| -rw-r--r-- | fs/nilfs2/btree.h | 8 | ||||
| -rw-r--r-- | fs/nilfs2/direct.h | 11 | ||||
| -rw-r--r-- | fs/nilfs2/gcinode.c | 2 | ||||
| -rw-r--r-- | fs/nilfs2/mdt.c | 1 | ||||
| -rw-r--r-- | fs/nilfs2/nilfs.h | 7 | ||||
| -rw-r--r-- | fs/nilfs2/super.c | 4 |
8 files changed, 12 insertions, 69 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index effdbdbe6c11..3dbdc1d356bf 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
| @@ -26,6 +26,8 @@ | |||
| 26 | #include "nilfs.h" | 26 | #include "nilfs.h" |
| 27 | #include "bmap.h" | 27 | #include "bmap.h" |
| 28 | #include "sb.h" | 28 | #include "sb.h" |
| 29 | #include "btree.h" | ||
| 30 | #include "direct.h" | ||
| 29 | #include "btnode.h" | 31 | #include "btnode.h" |
| 30 | #include "mdt.h" | 32 | #include "mdt.h" |
| 31 | #include "dat.h" | 33 | #include "dat.h" |
| @@ -533,7 +535,7 @@ void nilfs_bmap_init_gc(struct nilfs_bmap *bmap) | |||
| 533 | 535 | ||
| 534 | void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap) | 536 | void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap) |
| 535 | { | 537 | { |
| 536 | memcpy(gcbmap, bmap, sizeof(union nilfs_bmap_union)); | 538 | memcpy(gcbmap, bmap, sizeof(*bmap)); |
| 537 | init_rwsem(&gcbmap->b_sem); | 539 | init_rwsem(&gcbmap->b_sem); |
| 538 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key); | 540 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key); |
| 539 | gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode; | 541 | gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode; |
| @@ -541,7 +543,7 @@ void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap) | |||
| 541 | 543 | ||
| 542 | void nilfs_bmap_commit_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap) | 544 | void nilfs_bmap_commit_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap) |
| 543 | { | 545 | { |
| 544 | memcpy(bmap, gcbmap, sizeof(union nilfs_bmap_union)); | 546 | memcpy(bmap, gcbmap, sizeof(*bmap)); |
| 545 | init_rwsem(&bmap->b_sem); | 547 | init_rwsem(&bmap->b_sem); |
| 546 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key); | 548 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key); |
| 547 | bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode; | 549 | bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode; |
diff --git a/fs/nilfs2/bmap_union.h b/fs/nilfs2/bmap_union.h deleted file mode 100644 index d41509bff47b..000000000000 --- a/fs/nilfs2/bmap_union.h +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * bmap_union.h - NILFS block mapping. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006-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 Koji Sato <koji@osrg.net>. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef _NILFS_BMAP_UNION_H | ||
| 24 | #define _NILFS_BMAP_UNION_H | ||
| 25 | |||
| 26 | #include "bmap.h" | ||
| 27 | #include "direct.h" | ||
| 28 | #include "btree.h" | ||
| 29 | |||
| 30 | /** | ||
| 31 | * nilfs_bmap_union - | ||
| 32 | * @bi_bmap: bmap structure | ||
| 33 | * @bi_btree: direct map structure | ||
| 34 | * @bi_direct: B-tree structure | ||
| 35 | */ | ||
| 36 | union nilfs_bmap_union { | ||
| 37 | struct nilfs_bmap bi_bmap; | ||
| 38 | struct nilfs_direct bi_direct; | ||
| 39 | struct nilfs_btree bi_btree; | ||
| 40 | }; | ||
| 41 | |||
| 42 | #endif /* _NILFS_BMAP_UNION_H */ | ||
diff --git a/fs/nilfs2/btree.h b/fs/nilfs2/btree.h index cffbfbad0a6b..22c02e35b6ef 100644 --- a/fs/nilfs2/btree.h +++ b/fs/nilfs2/btree.h | |||
| @@ -31,14 +31,6 @@ | |||
| 31 | #include "bmap.h" | 31 | #include "bmap.h" |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * struct nilfs_btree - B-tree structure | ||
| 35 | * @bt_bmap: bmap base structure | ||
| 36 | */ | ||
| 37 | struct nilfs_btree { | ||
| 38 | struct nilfs_bmap bt_bmap; | ||
| 39 | }; | ||
| 40 | |||
| 41 | /** | ||
| 42 | * struct nilfs_btree_path - A path on which B-tree operations are executed | 34 | * struct nilfs_btree_path - A path on which B-tree operations are executed |
| 43 | * @bp_bh: buffer head of node block | 35 | * @bp_bh: buffer head of node block |
| 44 | * @bp_sib_bh: buffer head of sibling node block | 36 | * @bp_sib_bh: buffer head of sibling node block |
diff --git a/fs/nilfs2/direct.h b/fs/nilfs2/direct.h index a5ffd66e25d0..dc643de20a25 100644 --- a/fs/nilfs2/direct.h +++ b/fs/nilfs2/direct.h | |||
| @@ -28,8 +28,6 @@ | |||
| 28 | #include "bmap.h" | 28 | #include "bmap.h" |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | struct nilfs_direct; | ||
| 32 | |||
| 33 | /** | 31 | /** |
| 34 | * struct nilfs_direct_node - direct node | 32 | * struct nilfs_direct_node - direct node |
| 35 | * @dn_flags: flags | 33 | * @dn_flags: flags |
| @@ -40,15 +38,6 @@ struct nilfs_direct_node { | |||
| 40 | __u8 pad[7]; | 38 | __u8 pad[7]; |
| 41 | }; | 39 | }; |
| 42 | 40 | ||
| 43 | /** | ||
| 44 | * struct nilfs_direct - direct mapping | ||
| 45 | * @d_bmap: bmap structure | ||
| 46 | */ | ||
| 47 | struct nilfs_direct { | ||
| 48 | struct nilfs_bmap d_bmap; | ||
| 49 | }; | ||
| 50 | |||
| 51 | |||
| 52 | #define NILFS_DIRECT_NBLOCKS (NILFS_BMAP_SIZE / sizeof(__le64) - 1) | 41 | #define NILFS_DIRECT_NBLOCKS (NILFS_BMAP_SIZE / sizeof(__le64) - 1) |
| 53 | #define NILFS_DIRECT_KEY_MIN 0 | 42 | #define NILFS_DIRECT_KEY_MIN 0 |
| 54 | #define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1) | 43 | #define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1) |
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c index edb53fcb7f83..b6343825f91a 100644 --- a/fs/nilfs2/gcinode.c +++ b/fs/nilfs2/gcinode.c | |||
| @@ -48,6 +48,8 @@ | |||
| 48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
| 49 | #include <linux/swap.h> | 49 | #include <linux/swap.h> |
| 50 | #include "nilfs.h" | 50 | #include "nilfs.h" |
| 51 | #include "btree.h" | ||
| 52 | #include "btnode.h" | ||
| 51 | #include "page.h" | 53 | #include "page.h" |
| 52 | #include "mdt.h" | 54 | #include "mdt.h" |
| 53 | #include "dat.h" | 55 | #include "dat.h" |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 024be8c35bb6..d01aff4957d9 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/swap.h> | 28 | #include <linux/swap.h> |
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | #include "nilfs.h" | 30 | #include "nilfs.h" |
| 31 | #include "btnode.h" | ||
| 31 | #include "segment.h" | 32 | #include "segment.h" |
| 32 | #include "page.h" | 33 | #include "page.h" |
| 33 | #include "mdt.h" | 34 | #include "mdt.h" |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 36998eaab02f..cfedc48d78d9 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include "the_nilfs.h" | 32 | #include "the_nilfs.h" |
| 33 | #include "sb.h" | 33 | #include "sb.h" |
| 34 | #include "bmap.h" | 34 | #include "bmap.h" |
| 35 | #include "bmap_union.h" | ||
| 36 | 35 | ||
| 37 | /* | 36 | /* |
| 38 | * nilfs inode data in memory | 37 | * nilfs inode data in memory |
| @@ -41,7 +40,7 @@ struct nilfs_inode_info { | |||
| 41 | __u32 i_flags; | 40 | __u32 i_flags; |
| 42 | unsigned long i_state; /* Dynamic state flags */ | 41 | unsigned long i_state; /* Dynamic state flags */ |
| 43 | struct nilfs_bmap *i_bmap; | 42 | struct nilfs_bmap *i_bmap; |
| 44 | union nilfs_bmap_union i_bmap_union; | 43 | struct nilfs_bmap i_bmap_data; |
| 45 | __u64 i_xattr; /* sector_t ??? */ | 44 | __u64 i_xattr; /* sector_t ??? */ |
| 46 | __u32 i_dir_start_lookup; | 45 | __u32 i_dir_start_lookup; |
| 47 | __u64 i_cno; /* check point number for GC inode */ | 46 | __u64 i_cno; /* check point number for GC inode */ |
| @@ -71,9 +70,7 @@ static inline struct nilfs_inode_info *NILFS_I(const struct inode *inode) | |||
| 71 | static inline struct nilfs_inode_info * | 70 | static inline struct nilfs_inode_info * |
| 72 | NILFS_BMAP_I(const struct nilfs_bmap *bmap) | 71 | NILFS_BMAP_I(const struct nilfs_bmap *bmap) |
| 73 | { | 72 | { |
| 74 | return container_of((union nilfs_bmap_union *)bmap, | 73 | return container_of(bmap, struct nilfs_inode_info, i_bmap_data); |
| 75 | struct nilfs_inode_info, | ||
| 76 | i_bmap_union); | ||
| 77 | } | 74 | } |
| 78 | 75 | ||
| 79 | static inline struct inode *NILFS_BTNC_I(struct address_space *btnc) | 76 | static inline struct inode *NILFS_BTNC_I(struct address_space *btnc) |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 952f4ccb18de..164457316df1 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
| @@ -55,6 +55,8 @@ | |||
| 55 | #include "nilfs.h" | 55 | #include "nilfs.h" |
| 56 | #include "mdt.h" | 56 | #include "mdt.h" |
| 57 | #include "alloc.h" | 57 | #include "alloc.h" |
| 58 | #include "btree.h" | ||
| 59 | #include "btnode.h" | ||
| 58 | #include "page.h" | 60 | #include "page.h" |
| 59 | #include "cpfile.h" | 61 | #include "cpfile.h" |
| 60 | #include "ifile.h" | 62 | #include "ifile.h" |
| @@ -1213,7 +1215,7 @@ static void nilfs_inode_init_once(void *obj) | |||
| 1213 | init_rwsem(&ii->xattr_sem); | 1215 | init_rwsem(&ii->xattr_sem); |
| 1214 | #endif | 1216 | #endif |
| 1215 | nilfs_btnode_cache_init_once(&ii->i_btnode_cache); | 1217 | nilfs_btnode_cache_init_once(&ii->i_btnode_cache); |
| 1216 | ii->i_bmap = (struct nilfs_bmap *)&ii->i_bmap_union; | 1218 | ii->i_bmap = &ii->i_bmap_data; |
| 1217 | inode_init_once(&ii->vfs_inode); | 1219 | inode_init_once(&ii->vfs_inode); |
| 1218 | } | 1220 | } |
| 1219 | 1221 | ||
