aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-12-26 10:05:49 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-01-10 00:37:54 -0500
commitbcbc8c648d6cc88f771435d8031c1a13e00945ed (patch)
treef74a2e7fffb5669823066f8fb875fff535ab8529 /fs
parent06df0f999247a3153c3ec284c7ada36ef785eb97 (diff)
nilfs2: do not pass sbi to functions which can get it from inode
This removes argument for passing nilfs_sb_info structure from nilfs_set_file_dirty and nilfs_load_inode_block functions. We can get a pointer to the structure from inodes. [Stephen Rothwell <sfr@canb.auug.org.au>: fix conflict with commit b74c79e99389cd79b31fcc08f82c24e492e63c7e] Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/dir.c3
-rw-r--r--fs/nilfs2/inode.c18
-rw-r--r--fs/nilfs2/nilfs.h6
-rw-r--r--fs/nilfs2/recovery.c2
4 files changed, 12 insertions, 17 deletions
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index cb003c8ee1f6..9d45773b79e6 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -91,7 +91,6 @@ static void nilfs_commit_chunk(struct page *page,
91 unsigned from, unsigned to) 91 unsigned from, unsigned to)
92{ 92{
93 struct inode *dir = mapping->host; 93 struct inode *dir = mapping->host;
94 struct nilfs_sb_info *sbi = NILFS_SB(dir->i_sb);
95 loff_t pos = page_offset(page) + from; 94 loff_t pos = page_offset(page) + from;
96 unsigned len = to - from; 95 unsigned len = to - from;
97 unsigned nr_dirty, copied; 96 unsigned nr_dirty, copied;
@@ -103,7 +102,7 @@ static void nilfs_commit_chunk(struct page *page,
103 i_size_write(dir, pos + copied); 102 i_size_write(dir, pos + copied);
104 if (IS_DIRSYNC(dir)) 103 if (IS_DIRSYNC(dir))
105 nilfs_set_transaction_flag(NILFS_TI_SYNC); 104 nilfs_set_transaction_flag(NILFS_TI_SYNC);
106 err = nilfs_set_file_dirty(sbi, dir, nr_dirty); 105 err = nilfs_set_file_dirty(dir, nr_dirty);
107 WARN_ON(err); /* do not happen */ 106 WARN_ON(err); /* do not happen */
108 unlock_page(page); 107 unlock_page(page);
109} 108}
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index b2a815033ee3..43416470e07b 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -181,10 +181,9 @@ static int nilfs_set_page_dirty(struct page *page)
181 181
182 if (ret) { 182 if (ret) {
183 struct inode *inode = page->mapping->host; 183 struct inode *inode = page->mapping->host;
184 struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb);
185 unsigned nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits); 184 unsigned nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits);
186 185
187 nilfs_set_file_dirty(sbi, inode, nr_dirty); 186 nilfs_set_file_dirty(inode, nr_dirty);
188 } 187 }
189 return ret; 188 return ret;
190} 189}
@@ -225,7 +224,7 @@ static int nilfs_write_end(struct file *file, struct address_space *mapping,
225 start + copied); 224 start + copied);
226 copied = generic_write_end(file, mapping, pos, len, copied, page, 225 copied = generic_write_end(file, mapping, pos, len, copied, page,
227 fsdata); 226 fsdata);
228 nilfs_set_file_dirty(NILFS_SB(inode->i_sb), inode, nr_dirty); 227 nilfs_set_file_dirty(inode, nr_dirty);
229 err = nilfs_transaction_commit(inode->i_sb); 228 err = nilfs_transaction_commit(inode->i_sb);
230 return err ? : copied; 229 return err ? : copied;
231} 230}
@@ -674,7 +673,7 @@ void nilfs_truncate(struct inode *inode)
674 nilfs_set_transaction_flag(NILFS_TI_SYNC); 673 nilfs_set_transaction_flag(NILFS_TI_SYNC);
675 674
676 nilfs_mark_inode_dirty(inode); 675 nilfs_mark_inode_dirty(inode);
677 nilfs_set_file_dirty(NILFS_SB(sb), inode, 0); 676 nilfs_set_file_dirty(inode, 0);
678 nilfs_transaction_commit(sb); 677 nilfs_transaction_commit(sb);
679 /* May construct a logical segment and may fail in sync mode. 678 /* May construct a logical segment and may fail in sync mode.
680 But truncate has no return value. */ 679 But truncate has no return value. */
@@ -792,9 +791,9 @@ int nilfs_permission(struct inode *inode, int mask, unsigned int flags)
792 return generic_permission(inode, mask, flags, NULL); 791 return generic_permission(inode, mask, flags, NULL);
793} 792}
794 793
795int nilfs_load_inode_block(struct nilfs_sb_info *sbi, struct inode *inode, 794int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh)
796 struct buffer_head **pbh)
797{ 795{
796 struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb);
798 struct nilfs_inode_info *ii = NILFS_I(inode); 797 struct nilfs_inode_info *ii = NILFS_I(inode);
799 int err; 798 int err;
800 799
@@ -835,9 +834,9 @@ int nilfs_inode_dirty(struct inode *inode)
835 return ret; 834 return ret;
836} 835}
837 836
838int nilfs_set_file_dirty(struct nilfs_sb_info *sbi, struct inode *inode, 837int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty)
839 unsigned nr_dirty)
840{ 838{
839 struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb);
841 struct nilfs_inode_info *ii = NILFS_I(inode); 840 struct nilfs_inode_info *ii = NILFS_I(inode);
842 841
843 atomic_add(nr_dirty, &sbi->s_nilfs->ns_ndirtyblks); 842 atomic_add(nr_dirty, &sbi->s_nilfs->ns_ndirtyblks);
@@ -870,11 +869,10 @@ int nilfs_set_file_dirty(struct nilfs_sb_info *sbi, struct inode *inode,
870 869
871int nilfs_mark_inode_dirty(struct inode *inode) 870int nilfs_mark_inode_dirty(struct inode *inode)
872{ 871{
873 struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb);
874 struct buffer_head *ibh; 872 struct buffer_head *ibh;
875 int err; 873 int err;
876 874
877 err = nilfs_load_inode_block(sbi, inode, &ibh); 875 err = nilfs_load_inode_block(inode, &ibh);
878 if (unlikely(err)) { 876 if (unlikely(err)) {
879 nilfs_warning(inode->i_sb, __func__, 877 nilfs_warning(inode->i_sb, __func__,
880 "failed to reget inode block.\n"); 878 "failed to reget inode block.\n");
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index a0e21363e865..981183d01250 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -257,11 +257,9 @@ extern void nilfs_truncate(struct inode *);
257extern void nilfs_evict_inode(struct inode *); 257extern void nilfs_evict_inode(struct inode *);
258extern int nilfs_setattr(struct dentry *, struct iattr *); 258extern int nilfs_setattr(struct dentry *, struct iattr *);
259int nilfs_permission(struct inode *inode, int mask, unsigned int flags); 259int nilfs_permission(struct inode *inode, int mask, unsigned int flags);
260extern int nilfs_load_inode_block(struct nilfs_sb_info *, struct inode *, 260int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
261 struct buffer_head **);
262extern int nilfs_inode_dirty(struct inode *); 261extern int nilfs_inode_dirty(struct inode *);
263extern int nilfs_set_file_dirty(struct nilfs_sb_info *, struct inode *, 262int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty);
264 unsigned);
265extern int nilfs_mark_inode_dirty(struct inode *); 263extern int nilfs_mark_inode_dirty(struct inode *);
266extern void nilfs_dirty_inode(struct inode *); 264extern void nilfs_dirty_inode(struct inode *);
267int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, 265int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index 5d2711c28da7..3dfcd3b7d389 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -535,7 +535,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
535 if (unlikely(err)) 535 if (unlikely(err))
536 goto failed_page; 536 goto failed_page;
537 537
538 err = nilfs_set_file_dirty(sbi, inode, 1); 538 err = nilfs_set_file_dirty(inode, 1);
539 if (unlikely(err)) 539 if (unlikely(err))
540 goto failed_page; 540 goto failed_page;
541 541