aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nilfs2/mdt.c9
-rw-r--r--fs/nilfs2/mdt.h8
-rw-r--r--fs/nilfs2/sufile.c4
-rw-r--r--fs/nilfs2/sufile.h2
4 files changed, 8 insertions, 15 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index 44326cfe1fa9..32695f3c4b9a 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -78,7 +78,7 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
78 struct buffer_head *, 78 struct buffer_head *,
79 void *)) 79 void *))
80{ 80{
81 struct the_nilfs *nilfs = NILFS_MDT(inode)->mi_nilfs; 81 struct the_nilfs *nilfs = NILFS_I_NILFS(inode);
82 struct super_block *sb = inode->i_sb; 82 struct super_block *sb = inode->i_sb;
83 struct nilfs_transaction_info ti; 83 struct nilfs_transaction_info ti;
84 struct buffer_head *bh; 84 struct buffer_head *bh;
@@ -167,9 +167,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
167 unlock_buffer(bh); 167 unlock_buffer(bh);
168 goto failed_bh; 168 goto failed_bh;
169 } 169 }
170 bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev; 170 map_bh(bh, inode->i_sb, (sector_t)blknum);
171 bh->b_blocknr = (sector_t)blknum;
172 set_buffer_mapped(bh);
173 171
174 bh->b_end_io = end_buffer_read_sync; 172 bh->b_end_io = end_buffer_read_sync;
175 get_bh(bh); 173 get_bh(bh);
@@ -412,7 +410,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
412 return 0; 410 return 0;
413 411
414 sb = inode->i_sb; 412 sb = inode->i_sb;
415 nilfs = NILFS_MDT(inode)->mi_nilfs; 413 nilfs = NILFS_SB(sb)->s_nilfs;
416 414
417 if (!sb) { 415 if (!sb) {
418 down_read(&nilfs->ns_writer_sem); 416 down_read(&nilfs->ns_writer_sem);
@@ -452,7 +450,6 @@ int nilfs_mdt_init(struct inode *inode, gfp_t gfp_mask, size_t objsz)
452 if (!mi) 450 if (!mi)
453 return -ENOMEM; 451 return -ENOMEM;
454 452
455 mi->mi_nilfs = NILFS_I_NILFS(inode);
456 init_rwsem(&mi->mi_sem); 453 init_rwsem(&mi->mi_sem);
457 inode->i_private = mi; 454 inode->i_private = mi;
458 455
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h
index 73ff7c055715..76356d2899ed 100644
--- a/fs/nilfs2/mdt.h
+++ b/fs/nilfs2/mdt.h
@@ -37,7 +37,6 @@ struct nilfs_shadow_map {
37 37
38/** 38/**
39 * struct nilfs_mdt_info - on-memory private data of meta data files 39 * struct nilfs_mdt_info - on-memory private data of meta data files
40 * @mi_nilfs: back pointer to the_nilfs struct
41 * @mi_sem: reader/writer semaphore for meta data operations 40 * @mi_sem: reader/writer semaphore for meta data operations
42 * @mi_bgl: per-blockgroup locking 41 * @mi_bgl: per-blockgroup locking
43 * @mi_entry_size: size of an entry 42 * @mi_entry_size: size of an entry
@@ -49,7 +48,6 @@ struct nilfs_shadow_map {
49 * @mi_blocks_per_desc_block: number of blocks per descriptor block 48 * @mi_blocks_per_desc_block: number of blocks per descriptor block
50 */ 49 */
51struct nilfs_mdt_info { 50struct nilfs_mdt_info {
52 struct the_nilfs *mi_nilfs;
53 struct rw_semaphore mi_sem; 51 struct rw_semaphore mi_sem;
54 struct blockgroup_lock *mi_bgl; 52 struct blockgroup_lock *mi_bgl;
55 unsigned mi_entry_size; 53 unsigned mi_entry_size;
@@ -68,9 +66,7 @@ static inline struct nilfs_mdt_info *NILFS_MDT(const struct inode *inode)
68 66
69static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode) 67static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode)
70{ 68{
71 struct super_block *sb = inode->i_sb; 69 return NILFS_SB(inode->i_sb)->s_nilfs;
72
73 return sb ? NILFS_SB(sb)->s_nilfs : NILFS_MDT(inode)->mi_nilfs;
74} 70}
75 71
76/* Default GFP flags using highmem */ 72/* Default GFP flags using highmem */
@@ -117,7 +113,7 @@ static inline void nilfs_mdt_clear_dirty(struct inode *inode)
117 113
118static inline __u64 nilfs_mdt_cno(struct inode *inode) 114static inline __u64 nilfs_mdt_cno(struct inode *inode)
119{ 115{
120 return NILFS_MDT(inode)->mi_nilfs->ns_cno; 116 return NILFS_I_NILFS(inode)->ns_cno;
121} 117}
122 118
123#define nilfs_mdt_bgl_lock(inode, bg) \ 119#define nilfs_mdt_bgl_lock(inode, bg) \
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
index 599d9c27761e..1d6f488ccae8 100644
--- a/fs/nilfs2/sufile.c
+++ b/fs/nilfs2/sufile.c
@@ -505,7 +505,7 @@ int nilfs_sufile_get_stat(struct inode *sufile, struct nilfs_sustat *sustat)
505{ 505{
506 struct buffer_head *header_bh; 506 struct buffer_head *header_bh;
507 struct nilfs_sufile_header *header; 507 struct nilfs_sufile_header *header;
508 struct the_nilfs *nilfs = NILFS_MDT(sufile)->mi_nilfs; 508 struct the_nilfs *nilfs = NILFS_I_NILFS(sufile);
509 void *kaddr; 509 void *kaddr;
510 int ret; 510 int ret;
511 511
@@ -583,7 +583,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf,
583 struct nilfs_segment_usage *su; 583 struct nilfs_segment_usage *su;
584 struct nilfs_suinfo *si = buf; 584 struct nilfs_suinfo *si = buf;
585 size_t susz = NILFS_MDT(sufile)->mi_entry_size; 585 size_t susz = NILFS_MDT(sufile)->mi_entry_size;
586 struct the_nilfs *nilfs = NILFS_MDT(sufile)->mi_nilfs; 586 struct the_nilfs *nilfs = NILFS_I_NILFS(sufile);
587 void *kaddr; 587 void *kaddr;
588 unsigned long nsegs, segusages_per_block; 588 unsigned long nsegs, segusages_per_block;
589 ssize_t n; 589 ssize_t n;
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h
index 203f6102a62f..a943fbacb45b 100644
--- a/fs/nilfs2/sufile.h
+++ b/fs/nilfs2/sufile.h
@@ -31,7 +31,7 @@
31 31
32static inline unsigned long nilfs_sufile_get_nsegments(struct inode *sufile) 32static inline unsigned long nilfs_sufile_get_nsegments(struct inode *sufile)
33{ 33{
34 return NILFS_MDT(sufile)->mi_nilfs->ns_nsegments; 34 return NILFS_I_NILFS(sufile)->ns_nsegments;
35} 35}
36 36
37unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile); 37unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile);