Skip to content

Commit

Permalink
nilfs2: get rid of nilfs_bmap_union
Browse files Browse the repository at this point in the history
This removes nilfs_bmap_union and finally unifies three structures and
the union in bmap/btree code into one.

Signed-off-by: Ryusuke Konishi <[email protected]>
  • Loading branch information
konis committed Jul 23, 2010
1 parent dc935be commit 05d0e94
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 69 deletions.
6 changes: 4 additions & 2 deletions fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "nilfs.h"
#include "bmap.h"
#include "sb.h"
#include "btree.h"
#include "direct.h"
#include "btnode.h"
#include "mdt.h"
#include "dat.h"
Expand Down Expand Up @@ -533,15 +535,15 @@ void nilfs_bmap_init_gc(struct nilfs_bmap *bmap)

void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
{
memcpy(gcbmap, bmap, sizeof(union nilfs_bmap_union));
memcpy(gcbmap, bmap, sizeof(*bmap));
init_rwsem(&gcbmap->b_sem);
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode;
}

void nilfs_bmap_commit_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
{
memcpy(bmap, gcbmap, sizeof(union nilfs_bmap_union));
memcpy(bmap, gcbmap, sizeof(*bmap));
init_rwsem(&bmap->b_sem);
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode;
Expand Down
42 changes: 0 additions & 42 deletions fs/nilfs2/bmap_union.h

This file was deleted.

8 changes: 0 additions & 8 deletions fs/nilfs2/btree.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
#include "btnode.h"
#include "bmap.h"

/**
* struct nilfs_btree - B-tree structure
* @bt_bmap: bmap base structure
*/
struct nilfs_btree {
struct nilfs_bmap bt_bmap;
};

/**
* struct nilfs_btree_path - A path on which B-tree operations are executed
* @bp_bh: buffer head of node block
Expand Down
11 changes: 0 additions & 11 deletions fs/nilfs2/direct.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "bmap.h"


struct nilfs_direct;

/**
* struct nilfs_direct_node - direct node
* @dn_flags: flags
Expand All @@ -40,15 +38,6 @@ struct nilfs_direct_node {
__u8 pad[7];
};

/**
* struct nilfs_direct - direct mapping
* @d_bmap: bmap structure
*/
struct nilfs_direct {
struct nilfs_bmap d_bmap;
};


#define NILFS_DIRECT_NBLOCKS (NILFS_BMAP_SIZE / sizeof(__le64) - 1)
#define NILFS_DIRECT_KEY_MIN 0
#define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1)
Expand Down
2 changes: 2 additions & 0 deletions fs/nilfs2/gcinode.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include <linux/slab.h>
#include <linux/swap.h>
#include "nilfs.h"
#include "btree.h"
#include "btnode.h"
#include "page.h"
#include "mdt.h"
#include "dat.h"
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/mdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/swap.h>
#include <linux/slab.h>
#include "nilfs.h"
#include "btnode.h"
#include "segment.h"
#include "page.h"
#include "mdt.h"
Expand Down
7 changes: 2 additions & 5 deletions fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "the_nilfs.h"
#include "sb.h"
#include "bmap.h"
#include "bmap_union.h"

/*
* nilfs inode data in memory
Expand All @@ -41,7 +40,7 @@ struct nilfs_inode_info {
__u32 i_flags;
unsigned long i_state; /* Dynamic state flags */
struct nilfs_bmap *i_bmap;
union nilfs_bmap_union i_bmap_union;
struct nilfs_bmap i_bmap_data;
__u64 i_xattr; /* sector_t ??? */
__u32 i_dir_start_lookup;
__u64 i_cno; /* check point number for GC inode */
Expand Down Expand Up @@ -71,9 +70,7 @@ static inline struct nilfs_inode_info *NILFS_I(const struct inode *inode)
static inline struct nilfs_inode_info *
NILFS_BMAP_I(const struct nilfs_bmap *bmap)
{
return container_of((union nilfs_bmap_union *)bmap,
struct nilfs_inode_info,
i_bmap_union);
return container_of(bmap, struct nilfs_inode_info, i_bmap_data);
}

static inline struct inode *NILFS_BTNC_I(struct address_space *btnc)
Expand Down
4 changes: 3 additions & 1 deletion fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#include "nilfs.h"
#include "mdt.h"
#include "alloc.h"
#include "btree.h"
#include "btnode.h"
#include "page.h"
#include "cpfile.h"
#include "ifile.h"
Expand Down Expand Up @@ -1213,7 +1215,7 @@ static void nilfs_inode_init_once(void *obj)
init_rwsem(&ii->xattr_sem);
#endif
nilfs_btnode_cache_init_once(&ii->i_btnode_cache);
ii->i_bmap = (struct nilfs_bmap *)&ii->i_bmap_union;
ii->i_bmap = &ii->i_bmap_data;
inode_init_once(&ii->vfs_inode);
}

Expand Down

0 comments on commit 05d0e94

Please sign in to comment.