Commit a53b4751ae92adb372017222887f3ec625cba60b

Authored by Ryusuke Konishi
1 parent 30c25be71f

nilfs2: use device's backing_dev_info for btree node caches

Previously, default_backing_dev_info was used for the mapping of btree
node caches.  This uses device dependent backing_dev_info to allow
detailed control of the device for the btree node pages.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

Showing 5 changed files with 13 additions and 6 deletions Side-by-side Diff

... ... @@ -48,13 +48,14 @@
48 48  
49 49 static struct address_space_operations def_btnode_aops;
50 50  
51   -void nilfs_btnode_cache_init(struct address_space *btnc)
  51 +void nilfs_btnode_cache_init(struct address_space *btnc,
  52 + struct backing_dev_info *bdi)
52 53 {
53 54 btnc->host = NULL; /* can safely set to host inode ? */
54 55 btnc->flags = 0;
55 56 mapping_set_gfp_mask(btnc, GFP_NOFS);
56 57 btnc->assoc_mapping = NULL;
57   - btnc->backing_dev_info = &default_backing_dev_info;
  58 + btnc->backing_dev_info = bdi;
58 59 btnc->a_ops = &def_btnode_aops;
59 60 }
60 61  
... ... @@ -38,7 +38,7 @@
38 38 };
39 39  
40 40 void nilfs_btnode_cache_init_once(struct address_space *);
41   -void nilfs_btnode_cache_init(struct address_space *);
  41 +void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *);
42 42 void nilfs_btnode_cache_clear(struct address_space *);
43 43 int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t,
44 44 struct buffer_head **, int);
... ... @@ -449,7 +449,7 @@
449 449 nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
450 450 ino_t ino, gfp_t gfp_mask)
451 451 {
452   - struct inode *inode = nilfs_alloc_inode(sb);
  452 + struct inode *inode = nilfs_alloc_inode_common(nilfs);
453 453  
454 454 if (!inode)
455 455 return NULL;
... ... @@ -263,6 +263,7 @@
263 263 extern struct dentry *nilfs_get_parent(struct dentry *);
264 264  
265 265 /* super.c */
  266 +extern struct inode *nilfs_alloc_inode_common(struct the_nilfs *);
266 267 extern struct inode *nilfs_alloc_inode(struct super_block *);
267 268 extern void nilfs_destroy_inode(struct inode *);
268 269 extern void nilfs_error(struct super_block *, const char *, const char *, ...)
... ... @@ -134,7 +134,7 @@
134 134  
135 135 static struct kmem_cache *nilfs_inode_cachep;
136 136  
137   -struct inode *nilfs_alloc_inode(struct super_block *sb)
  137 +struct inode *nilfs_alloc_inode_common(struct the_nilfs *nilfs)
138 138 {
139 139 struct nilfs_inode_info *ii;
140 140  
141 141  
... ... @@ -144,8 +144,13 @@
144 144 ii->i_bh = NULL;
145 145 ii->i_state = 0;
146 146 ii->vfs_inode.i_version = 1;
147   - nilfs_btnode_cache_init(&ii->i_btnode_cache);
  147 + nilfs_btnode_cache_init(&ii->i_btnode_cache, nilfs->ns_bdi);
148 148 return &ii->vfs_inode;
  149 +}
  150 +
  151 +struct inode *nilfs_alloc_inode(struct super_block *sb)
  152 +{
  153 + return nilfs_alloc_inode_common(NILFS_SB(sb)->s_nilfs);
149 154 }
150 155  
151 156 void nilfs_destroy_inode(struct inode *inode)