]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
nilfs2: remove useless b_low and b_high fields from nilfs_bmap struct
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Sat, 23 May 2009 15:09:44 +0000 (00:09 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Wed, 10 Jun 2009 14:41:10 +0000 (23:41 +0900)
This will cut off 16 bytes from the nilfs_bmap struct which is
embedded in the on-memory inode of nilfs.

The b_high field was never used, and the b_low field stores a constant
value which can be determined by whether the inode uses btree for
block mapping or not.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
fs/nilfs2/bmap.c
fs/nilfs2/bmap.h
fs/nilfs2/btree.c
fs/nilfs2/btree.h
fs/nilfs2/direct.c
fs/nilfs2/direct.h

index cf5c5d2cfa00dd737cc59159607dc0f53a7f5ffa..de67d2a125151867ee91f8144639a26f9d68a8d1 100644 (file)
@@ -101,8 +101,7 @@ static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
                        if (n < 0)
                                return n;
                        ret = nilfs_btree_convert_and_insert(
-                               bmap, key, ptr, keys, ptrs, n,
-                               NILFS_BMAP_LARGE_LOW, NILFS_BMAP_LARGE_HIGH);
+                               bmap, key, ptr, keys, ptrs, n);
                        if (ret == 0)
                                bmap->b_u.u_flags |= NILFS_BMAP_LARGE;
 
@@ -158,8 +157,7 @@ static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key)
                        if (n < 0)
                                return n;
                        ret = nilfs_direct_delete_and_convert(
-                               bmap, key, keys, ptrs, n,
-                               NILFS_BMAP_SMALL_LOW, NILFS_BMAP_SMALL_HIGH);
+                               bmap, key, keys, ptrs, n);
                        if (ret == 0)
                                bmap->b_u.u_flags &= ~NILFS_BMAP_LARGE;
 
@@ -681,12 +679,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
        }
 
        return (bmap->b_u.u_flags & NILFS_BMAP_LARGE) ?
-               nilfs_btree_init(bmap,
-                                NILFS_BMAP_LARGE_LOW,
-                                NILFS_BMAP_LARGE_HIGH) :
-               nilfs_direct_init(bmap,
-                                 NILFS_BMAP_SMALL_LOW,
-                                 NILFS_BMAP_SMALL_HIGH);
+               nilfs_btree_init(bmap) : nilfs_direct_init(bmap);
 }
 
 /**
index 978073bf565086f327a9e8e532f6a4cae79de193..28c77bb71bb78d2ac93bed1e375fd83b71664cbc 100644 (file)
@@ -125,8 +125,6 @@ static inline int nilfs_bmap_is_new_ptr(unsigned long ptr)
  * @b_inode: owner of bmap
  * @b_ops: bmap operation table
  * @b_pops: bmap ptr operation table
- * @b_low: low watermark of conversion
- * @b_high: high watermark of conversion
  * @b_last_allocated_key: last allocated key for data block
  * @b_last_allocated_ptr: last allocated ptr for data block
  * @b_state: state
@@ -140,8 +138,6 @@ struct nilfs_bmap {
        struct inode *b_inode;
        const struct nilfs_bmap_operations *b_ops;
        const struct nilfs_bmap_ptr_operations *b_pops;
-       __u64 b_low;
-       __u64 b_high;
        __u64 b_last_allocated_key;
        __u64 b_last_allocated_ptr;
        int b_state;
index 5b2606a0ac4860cec75f5b278ca5ab0e50e62d37..f5a0ec64e1aa6446bdcc781feae6b45efa49b9b8 100644 (file)
@@ -1527,7 +1527,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *bmap, __u64 key)
        if (bh != NULL)
                brelse(bh);
 
-       return (maxkey == key) && (nextmaxkey < bmap->b_low);
+       return (maxkey == key) && (nextmaxkey < NILFS_BMAP_LARGE_LOW);
 }
 
 static int nilfs_btree_gather_data(struct nilfs_bmap *bmap,
@@ -1634,7 +1634,7 @@ static void
 nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
                                      __u64 key, __u64 ptr,
                                      const __u64 *keys, const __u64 *ptrs,
-                                     int n, __u64 low, __u64 high,
+                                     int n,
                                      union nilfs_bmap_ptr_req *dreq,
                                      union nilfs_bmap_ptr_req *nreq,
                                      struct buffer_head *bh)
@@ -1652,7 +1652,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
 
        /* convert and insert */
        btree = (struct nilfs_btree *)bmap;
-       nilfs_btree_init(bmap, low, high);
+       nilfs_btree_init(bmap);
        if (nreq != NULL) {
                bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq);
                bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq);
@@ -1701,13 +1701,10 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
  * @keys:
  * @ptrs:
  * @n:
- * @low:
- * @high:
  */
 int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap,
                                   __u64 key, __u64 ptr,
-                                  const __u64 *keys, const __u64 *ptrs,
-                                  int n, __u64 low, __u64 high)
+                                  const __u64 *keys, const __u64 *ptrs, int n)
 {
        struct buffer_head *bh;
        union nilfs_bmap_ptr_req dreq, nreq, *di, *ni;
@@ -1732,7 +1729,7 @@ int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap,
        if (ret < 0)
                return ret;
        nilfs_btree_commit_convert_and_insert(bmap, key, ptr, keys, ptrs, n,
-                                             low, high, di, ni, bh);
+                                             di, ni, bh);
        nilfs_bmap_add_blocks(bmap, stats.bs_nblocks);
        return 0;
 }
@@ -2245,14 +2242,11 @@ static const struct nilfs_btree_operations nilfs_btree_ops_p = {
        .btop_assign            =       nilfs_btree_assign_p,
 };
 
-int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
+int nilfs_btree_init(struct nilfs_bmap *bmap)
 {
-       struct nilfs_btree *btree;
+       struct nilfs_btree *btree = (struct nilfs_btree *)bmap;
 
-       btree = (struct nilfs_btree *)bmap;
        bmap->b_ops = &nilfs_btree_ops;
-       bmap->b_low = low;
-       bmap->b_high = high;
        switch (bmap->b_inode->i_ino) {
        case NILFS_DAT_INO:
                btree->bt_ops = &nilfs_btree_ops_p;
@@ -2267,7 +2261,5 @@ int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
 
 void nilfs_btree_init_gc(struct nilfs_bmap *bmap)
 {
-       bmap->b_low = NILFS_BMAP_LARGE_LOW;
-       bmap->b_high = NILFS_BMAP_LARGE_HIGH;
        bmap->b_ops = &nilfs_btree_ops_gc;
 }
index 4766deb52fb165f457255d4579381fe641550268..48aad2a0c59f350f5ffc2f99201e560a80087384 100644 (file)
@@ -108,10 +108,9 @@ struct nilfs_btree {
 
 int nilfs_btree_path_cache_init(void);
 void nilfs_btree_path_cache_destroy(void);
-int nilfs_btree_init(struct nilfs_bmap *, __u64, __u64);
+int nilfs_btree_init(struct nilfs_bmap *);
 int nilfs_btree_convert_and_insert(struct nilfs_bmap *, __u64, __u64,
-                                  const __u64 *, const __u64 *,
-                                  int, __u64, __u64);
+                                  const __u64 *, const __u64 *, int);
 void nilfs_btree_init_gc(struct nilfs_bmap *);
 
 #endif /* _NILFS_BTREE_H */
index eaeccb068b5e9f67359dc8dc7550c56c14f27c0f..8e8095c2e1bb3c24912236abe36fb627d9b0c86b 100644 (file)
@@ -242,8 +242,7 @@ static int nilfs_direct_gather_data(struct nilfs_bmap *bmap,
 }
 
 int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap,
-                                   __u64 key, __u64 *keys, __u64 *ptrs,
-                                   int n, __u64 low, __u64 high)
+                                   __u64 key, __u64 *keys, __u64 *ptrs, int n)
 {
        struct nilfs_direct *direct;
        __le64 *dptrs;
@@ -273,8 +272,7 @@ int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap,
                        dptrs[i] = NILFS_BMAP_INVALID_PTR;
        }
 
-       nilfs_direct_init(bmap, low, high);
-
+       nilfs_direct_init(bmap);
        return 0;
 }
 
@@ -410,14 +408,11 @@ static const struct nilfs_direct_operations nilfs_direct_ops_p = {
        .dop_assign             =       nilfs_direct_assign_p,
 };
 
-int nilfs_direct_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
+int nilfs_direct_init(struct nilfs_bmap *bmap)
 {
-       struct nilfs_direct *direct;
+       struct nilfs_direct *direct = (struct nilfs_direct *)bmap;
 
-       direct = (struct nilfs_direct *)bmap;
        bmap->b_ops = &nilfs_direct_ops;
-       bmap->b_low = low;
-       bmap->b_high = high;
        switch (bmap->b_inode->i_ino) {
        case NILFS_DAT_INO:
                direct->d_ops = &nilfs_direct_ops_p;
index 45d2c5cda8120682e182c526afdecd4acb647aec..d645f13b9aea1e21e5e48d6fe90b49fd5abd5dc2 100644 (file)
@@ -70,9 +70,9 @@ struct nilfs_direct {
 #define NILFS_DIRECT_KEY_MAX   (NILFS_DIRECT_NBLOCKS - 1)
 
 
-int nilfs_direct_init(struct nilfs_bmap *, __u64, __u64);
+int nilfs_direct_init(struct nilfs_bmap *);
 int nilfs_direct_delete_and_convert(struct nilfs_bmap *, __u64, __u64 *,
-                                   __u64 *, int, __u64, __u64);
+                                   __u64 *, int);
 
 
 #endif /* _NILFS_DIRECT_H */