Skip to content

Commit 3033342

Browse files
committed
nilfs2: remove useless b_low and b_high fields from nilfs_bmap struct
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>
1 parent e473c1f commit 3033342

6 files changed

Lines changed: 18 additions & 43 deletions

File tree

‎fs/nilfs2/bmap.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
101101
if (n < 0)
102102
return n;
103103
ret = nilfs_btree_convert_and_insert(
104-
bmap, key, ptr, keys, ptrs, n,
105-
NILFS_BMAP_LARGE_LOW, NILFS_BMAP_LARGE_HIGH);
104+
bmap, key, ptr, keys, ptrs, n);
106105
if (ret == 0)
107106
bmap->b_u.u_flags |= NILFS_BMAP_LARGE;
108107

@@ -158,8 +157,7 @@ static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key)
158157
if (n < 0)
159158
return n;
160159
ret = nilfs_direct_delete_and_convert(
161-
bmap, key, keys, ptrs, n,
162-
NILFS_BMAP_SMALL_LOW, NILFS_BMAP_SMALL_HIGH);
160+
bmap, key, keys, ptrs, n);
163161
if (ret == 0)
164162
bmap->b_u.u_flags &= ~NILFS_BMAP_LARGE;
165163

@@ -681,12 +679,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
681679
}
682680

683681
return (bmap->b_u.u_flags & NILFS_BMAP_LARGE) ?
684-
nilfs_btree_init(bmap,
685-
NILFS_BMAP_LARGE_LOW,
686-
NILFS_BMAP_LARGE_HIGH) :
687-
nilfs_direct_init(bmap,
688-
NILFS_BMAP_SMALL_LOW,
689-
NILFS_BMAP_SMALL_HIGH);
682+
nilfs_btree_init(bmap) : nilfs_direct_init(bmap);
690683
}
691684

692685
/**

‎fs/nilfs2/bmap.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ static inline int nilfs_bmap_is_new_ptr(unsigned long ptr)
125125
* @b_inode: owner of bmap
126126
* @b_ops: bmap operation table
127127
* @b_pops: bmap ptr operation table
128-
* @b_low: low watermark of conversion
129-
* @b_high: high watermark of conversion
130128
* @b_last_allocated_key: last allocated key for data block
131129
* @b_last_allocated_ptr: last allocated ptr for data block
132130
* @b_state: state
@@ -140,8 +138,6 @@ struct nilfs_bmap {
140138
struct inode *b_inode;
141139
const struct nilfs_bmap_operations *b_ops;
142140
const struct nilfs_bmap_ptr_operations *b_pops;
143-
__u64 b_low;
144-
__u64 b_high;
145141
__u64 b_last_allocated_key;
146142
__u64 b_last_allocated_ptr;
147143
int b_state;

‎fs/nilfs2/btree.c‎

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *bmap, __u64 key)
15271527
if (bh != NULL)
15281528
brelse(bh);
15291529

1530-
return (maxkey == key) && (nextmaxkey < bmap->b_low);
1530+
return (maxkey == key) && (nextmaxkey < NILFS_BMAP_LARGE_LOW);
15311531
}
15321532

15331533
static int nilfs_btree_gather_data(struct nilfs_bmap *bmap,
@@ -1634,7 +1634,7 @@ static void
16341634
nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
16351635
__u64 key, __u64 ptr,
16361636
const __u64 *keys, const __u64 *ptrs,
1637-
int n, __u64 low, __u64 high,
1637+
int n,
16381638
union nilfs_bmap_ptr_req *dreq,
16391639
union nilfs_bmap_ptr_req *nreq,
16401640
struct buffer_head *bh)
@@ -1652,7 +1652,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
16521652

16531653
/* convert and insert */
16541654
btree = (struct nilfs_btree *)bmap;
1655-
nilfs_btree_init(bmap, low, high);
1655+
nilfs_btree_init(bmap);
16561656
if (nreq != NULL) {
16571657
bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq);
16581658
bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq);
@@ -1701,13 +1701,10 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
17011701
* @keys:
17021702
* @ptrs:
17031703
* @n:
1704-
* @low:
1705-
* @high:
17061704
*/
17071705
int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap,
17081706
__u64 key, __u64 ptr,
1709-
const __u64 *keys, const __u64 *ptrs,
1710-
int n, __u64 low, __u64 high)
1707+
const __u64 *keys, const __u64 *ptrs, int n)
17111708
{
17121709
struct buffer_head *bh;
17131710
union nilfs_bmap_ptr_req dreq, nreq, *di, *ni;
@@ -1732,7 +1729,7 @@ int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap,
17321729
if (ret < 0)
17331730
return ret;
17341731
nilfs_btree_commit_convert_and_insert(bmap, key, ptr, keys, ptrs, n,
1735-
low, high, di, ni, bh);
1732+
di, ni, bh);
17361733
nilfs_bmap_add_blocks(bmap, stats.bs_nblocks);
17371734
return 0;
17381735
}
@@ -2245,14 +2242,11 @@ static const struct nilfs_btree_operations nilfs_btree_ops_p = {
22452242
.btop_assign = nilfs_btree_assign_p,
22462243
};
22472244

2248-
int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
2245+
int nilfs_btree_init(struct nilfs_bmap *bmap)
22492246
{
2250-
struct nilfs_btree *btree;
2247+
struct nilfs_btree *btree = (struct nilfs_btree *)bmap;
22512248

2252-
btree = (struct nilfs_btree *)bmap;
22532249
bmap->b_ops = &nilfs_btree_ops;
2254-
bmap->b_low = low;
2255-
bmap->b_high = high;
22562250
switch (bmap->b_inode->i_ino) {
22572251
case NILFS_DAT_INO:
22582252
btree->bt_ops = &nilfs_btree_ops_p;
@@ -2267,7 +2261,5 @@ int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
22672261

22682262
void nilfs_btree_init_gc(struct nilfs_bmap *bmap)
22692263
{
2270-
bmap->b_low = NILFS_BMAP_LARGE_LOW;
2271-
bmap->b_high = NILFS_BMAP_LARGE_HIGH;
22722264
bmap->b_ops = &nilfs_btree_ops_gc;
22732265
}

‎fs/nilfs2/btree.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ struct nilfs_btree {
108108

109109
int nilfs_btree_path_cache_init(void);
110110
void nilfs_btree_path_cache_destroy(void);
111-
int nilfs_btree_init(struct nilfs_bmap *, __u64, __u64);
111+
int nilfs_btree_init(struct nilfs_bmap *);
112112
int nilfs_btree_convert_and_insert(struct nilfs_bmap *, __u64, __u64,
113-
const __u64 *, const __u64 *,
114-
int, __u64, __u64);
113+
const __u64 *, const __u64 *, int);
115114
void nilfs_btree_init_gc(struct nilfs_bmap *);
116115

117116
#endif /* _NILFS_BTREE_H */

‎fs/nilfs2/direct.c‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ static int nilfs_direct_gather_data(struct nilfs_bmap *bmap,
242242
}
243243

244244
int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap,
245-
__u64 key, __u64 *keys, __u64 *ptrs,
246-
int n, __u64 low, __u64 high)
245+
__u64 key, __u64 *keys, __u64 *ptrs, int n)
247246
{
248247
struct nilfs_direct *direct;
249248
__le64 *dptrs;
@@ -273,8 +272,7 @@ int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap,
273272
dptrs[i] = NILFS_BMAP_INVALID_PTR;
274273
}
275274

276-
nilfs_direct_init(bmap, low, high);
277-
275+
nilfs_direct_init(bmap);
278276
return 0;
279277
}
280278

@@ -410,14 +408,11 @@ static const struct nilfs_direct_operations nilfs_direct_ops_p = {
410408
.dop_assign = nilfs_direct_assign_p,
411409
};
412410

413-
int nilfs_direct_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
411+
int nilfs_direct_init(struct nilfs_bmap *bmap)
414412
{
415-
struct nilfs_direct *direct;
413+
struct nilfs_direct *direct = (struct nilfs_direct *)bmap;
416414

417-
direct = (struct nilfs_direct *)bmap;
418415
bmap->b_ops = &nilfs_direct_ops;
419-
bmap->b_low = low;
420-
bmap->b_high = high;
421416
switch (bmap->b_inode->i_ino) {
422417
case NILFS_DAT_INO:
423418
direct->d_ops = &nilfs_direct_ops_p;

‎fs/nilfs2/direct.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ struct nilfs_direct {
7070
#define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1)
7171

7272

73-
int nilfs_direct_init(struct nilfs_bmap *, __u64, __u64);
73+
int nilfs_direct_init(struct nilfs_bmap *);
7474
int nilfs_direct_delete_and_convert(struct nilfs_bmap *, __u64, __u64 *,
75-
__u64 *, int, __u64, __u64);
75+
__u64 *, int);
7676

7777

7878
#endif /* _NILFS_DIRECT_H */

0 commit comments

Comments
 (0)