aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/btnode.c20
-rw-r--r--fs/nilfs2/btnode.h4
-rw-r--r--fs/nilfs2/gcinode.c2
3 files changed, 6 insertions, 20 deletions
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
index 7086a2a1f7fa..59658f08d289 100644
--- a/fs/nilfs2/btnode.c
+++ b/fs/nilfs2/btnode.c
@@ -95,8 +95,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
95} 95}
96 96
97int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr, 97int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
98 sector_t pblocknr, struct buffer_head **pbh, 98 sector_t pblocknr, struct buffer_head **pbh)
99 int newblk)
100{ 99{
101 struct buffer_head *bh; 100 struct buffer_head *bh;
102 struct inode *inode = NILFS_BTNC_I(btnc); 101 struct inode *inode = NILFS_BTNC_I(btnc);
@@ -107,19 +106,6 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
107 return -ENOMEM; 106 return -ENOMEM;
108 107
109 err = -EEXIST; /* internal code */ 108 err = -EEXIST; /* internal code */
110 if (newblk) {
111 if (unlikely(buffer_mapped(bh) || buffer_uptodate(bh) ||
112 buffer_dirty(bh))) {
113 brelse(bh);
114 BUG();
115 }
116 memset(bh->b_data, 0, 1 << inode->i_blkbits);
117 bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
118 bh->b_blocknr = blocknr;
119 set_buffer_mapped(bh);
120 set_buffer_uptodate(bh);
121 goto found;
122 }
123 109
124 if (buffer_uptodate(bh) || buffer_dirty(bh)) 110 if (buffer_uptodate(bh) || buffer_dirty(bh))
125 goto found; 111 goto found;
@@ -162,12 +148,12 @@ out_locked:
162} 148}
163 149
164int nilfs_btnode_get(struct address_space *btnc, __u64 blocknr, 150int nilfs_btnode_get(struct address_space *btnc, __u64 blocknr,
165 sector_t pblocknr, struct buffer_head **pbh, int newblk) 151 sector_t pblocknr, struct buffer_head **pbh)
166{ 152{
167 struct buffer_head *bh; 153 struct buffer_head *bh;
168 int err; 154 int err;
169 155
170 err = nilfs_btnode_submit_block(btnc, blocknr, pblocknr, pbh, newblk); 156 err = nilfs_btnode_submit_block(btnc, blocknr, pblocknr, pbh);
171 if (err == -EEXIST) /* internal code (cache hit) */ 157 if (err == -EEXIST) /* internal code (cache hit) */
172 return 0; 158 return 0;
173 if (unlikely(err)) 159 if (unlikely(err))
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h
index c53644c0cf0f..3d5cf08a47f7 100644
--- a/fs/nilfs2/btnode.h
+++ b/fs/nilfs2/btnode.h
@@ -43,9 +43,9 @@ void nilfs_btnode_cache_clear(struct address_space *);
43struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, 43struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
44 __u64 blocknr); 44 __u64 blocknr);
45int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, 45int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t,
46 struct buffer_head **, int); 46 struct buffer_head **);
47int nilfs_btnode_get(struct address_space *, __u64, sector_t, 47int nilfs_btnode_get(struct address_space *, __u64, sector_t,
48 struct buffer_head **, int); 48 struct buffer_head **);
49void nilfs_btnode_delete(struct buffer_head *); 49void nilfs_btnode_delete(struct buffer_head *);
50int nilfs_btnode_prepare_change_key(struct address_space *, 50int nilfs_btnode_prepare_change_key(struct address_space *,
51 struct nilfs_btnode_chkey_ctxt *); 51 struct nilfs_btnode_chkey_ctxt *);
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 67d2099475b2..e16a6664dfa2 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -149,7 +149,7 @@ int nilfs_gccache_submit_read_node(struct inode *inode, sector_t pbn,
149 __u64 vbn, struct buffer_head **out_bh) 149 __u64 vbn, struct buffer_head **out_bh)
150{ 150{
151 int ret = nilfs_btnode_submit_block(&NILFS_I(inode)->i_btnode_cache, 151 int ret = nilfs_btnode_submit_block(&NILFS_I(inode)->i_btnode_cache,
152 vbn ? : pbn, pbn, out_bh, 0); 152 vbn ? : pbn, pbn, out_bh);
153 if (ret == -EEXIST) /* internal code (cache hit) */ 153 if (ret == -EEXIST) /* internal code (cache hit) */
154 ret = 0; 154 ret = 0;
155 return ret; 155 return ret;