aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/btnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/btnode.c')
-rw-r--r--fs/nilfs2/btnode.c20
1 files changed, 3 insertions, 17 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))