diff options
-rw-r--r-- | fs/nilfs2/mdt.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index a5cd80162dc5..1ae8d56052c3 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -103,15 +103,12 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block, | |||
103 | goto failed_unlock; | 103 | goto failed_unlock; |
104 | 104 | ||
105 | err = -EEXIST; | 105 | err = -EEXIST; |
106 | if (buffer_uptodate(bh) || buffer_mapped(bh)) | 106 | if (buffer_uptodate(bh)) |
107 | goto failed_bh; | 107 | goto failed_bh; |
108 | #if 0 | 108 | |
109 | /* The uptodate flag is not protected by the page lock, but | ||
110 | the mapped flag is. Thus, we don't have to wait the buffer. */ | ||
111 | wait_on_buffer(bh); | 109 | wait_on_buffer(bh); |
112 | if (buffer_uptodate(bh)) | 110 | if (buffer_uptodate(bh)) |
113 | goto failed_bh; | 111 | goto failed_bh; |
114 | #endif | ||
115 | 112 | ||
116 | bh->b_bdev = nilfs->ns_bdev; | 113 | bh->b_bdev = nilfs->ns_bdev; |
117 | err = nilfs_mdt_insert_new_block(inode, block, bh, init_block); | 114 | err = nilfs_mdt_insert_new_block(inode, block, bh, init_block); |
@@ -162,17 +159,15 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, | |||
162 | unlock_buffer(bh); | 159 | unlock_buffer(bh); |
163 | goto out; | 160 | goto out; |
164 | } | 161 | } |
165 | if (!buffer_mapped(bh)) { /* unused buffer */ | 162 | |
166 | ret = nilfs_bmap_lookup(NILFS_I(inode)->i_bmap, blkoff, | 163 | ret = nilfs_bmap_lookup(NILFS_I(inode)->i_bmap, blkoff, &blknum); |
167 | &blknum); | 164 | if (unlikely(ret)) { |
168 | if (unlikely(ret)) { | 165 | unlock_buffer(bh); |
169 | unlock_buffer(bh); | 166 | goto failed_bh; |
170 | goto failed_bh; | ||
171 | } | ||
172 | bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev; | ||
173 | bh->b_blocknr = blknum; | ||
174 | set_buffer_mapped(bh); | ||
175 | } | 167 | } |
168 | bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev; | ||
169 | bh->b_blocknr = blknum; | ||
170 | set_buffer_mapped(bh); | ||
176 | 171 | ||
177 | bh->b_end_io = end_buffer_read_sync; | 172 | bh->b_end_io = end_buffer_read_sync; |
178 | get_bh(bh); | 173 | get_bh(bh); |