Commit 05d0e94b66dbdf9d90371b39dc7a6b390ba74d41
1 parent
dc935be2a0
Exists in
master
and in
39 other branches
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>
Showing 8 changed files with 12 additions and 69 deletions Side-by-side Diff
fs/nilfs2/bmap.c
... | ... | @@ -26,6 +26,8 @@ |
26 | 26 | #include "nilfs.h" |
27 | 27 | #include "bmap.h" |
28 | 28 | #include "sb.h" |
29 | +#include "btree.h" | |
30 | +#include "direct.h" | |
29 | 31 | #include "btnode.h" |
30 | 32 | #include "mdt.h" |
31 | 33 | #include "dat.h" |
... | ... | @@ -533,7 +535,7 @@ |
533 | 535 | |
534 | 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 | 539 | init_rwsem(&gcbmap->b_sem); |
538 | 540 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key); |
539 | 541 | gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode; |
... | ... | @@ -541,7 +543,7 @@ |
541 | 543 | |
542 | 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 | 547 | init_rwsem(&bmap->b_sem); |
546 | 548 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key); |
547 | 549 | bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode; |
fs/nilfs2/bmap_union.h
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 */ |
fs/nilfs2/btree.h
... | ... | @@ -31,14 +31,6 @@ |
31 | 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 | 34 | * struct nilfs_btree_path - A path on which B-tree operations are executed |
43 | 35 | * @bp_bh: buffer head of node block |
44 | 36 | * @bp_sib_bh: buffer head of sibling node block |
fs/nilfs2/direct.h
... | ... | @@ -28,8 +28,6 @@ |
28 | 28 | #include "bmap.h" |
29 | 29 | |
30 | 30 | |
31 | -struct nilfs_direct; | |
32 | - | |
33 | 31 | /** |
34 | 32 | * struct nilfs_direct_node - direct node |
35 | 33 | * @dn_flags: flags |
... | ... | @@ -39,15 +37,6 @@ |
39 | 37 | __u8 dn_flags; |
40 | 38 | __u8 pad[7]; |
41 | 39 | }; |
42 | - | |
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 | 40 | |
52 | 41 | #define NILFS_DIRECT_NBLOCKS (NILFS_BMAP_SIZE / sizeof(__le64) - 1) |
53 | 42 | #define NILFS_DIRECT_KEY_MIN 0 |
fs/nilfs2/gcinode.c
fs/nilfs2/mdt.c
fs/nilfs2/nilfs.h
... | ... | @@ -32,7 +32,6 @@ |
32 | 32 | #include "the_nilfs.h" |
33 | 33 | #include "sb.h" |
34 | 34 | #include "bmap.h" |
35 | -#include "bmap_union.h" | |
36 | 35 | |
37 | 36 | /* |
38 | 37 | * nilfs inode data in memory |
... | ... | @@ -41,7 +40,7 @@ |
41 | 40 | __u32 i_flags; |
42 | 41 | unsigned long i_state; /* Dynamic state flags */ |
43 | 42 | struct nilfs_bmap *i_bmap; |
44 | - union nilfs_bmap_union i_bmap_union; | |
43 | + struct nilfs_bmap i_bmap_data; | |
45 | 44 | __u64 i_xattr; /* sector_t ??? */ |
46 | 45 | __u32 i_dir_start_lookup; |
47 | 46 | __u64 i_cno; /* check point number for GC inode */ |
... | ... | @@ -71,9 +70,7 @@ |
71 | 70 | static inline struct nilfs_inode_info * |
72 | 71 | NILFS_BMAP_I(const struct nilfs_bmap *bmap) |
73 | 72 | { |
74 | - return container_of((union nilfs_bmap_union *)bmap, | |
75 | - struct nilfs_inode_info, | |
76 | - i_bmap_union); | |
73 | + return container_of(bmap, struct nilfs_inode_info, i_bmap_data); | |
77 | 74 | } |
78 | 75 | |
79 | 76 | static inline struct inode *NILFS_BTNC_I(struct address_space *btnc) |
fs/nilfs2/super.c
... | ... | @@ -55,6 +55,8 @@ |
55 | 55 | #include "nilfs.h" |
56 | 56 | #include "mdt.h" |
57 | 57 | #include "alloc.h" |
58 | +#include "btree.h" | |
59 | +#include "btnode.h" | |
58 | 60 | #include "page.h" |
59 | 61 | #include "cpfile.h" |
60 | 62 | #include "ifile.h" |
... | ... | @@ -1213,7 +1215,7 @@ |
1213 | 1215 | init_rwsem(&ii->xattr_sem); |
1214 | 1216 | #endif |
1215 | 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 | 1219 | inode_init_once(&ii->vfs_inode); |
1218 | 1220 | } |
1219 | 1221 |