Commit d6d4f1cb authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix to check current blkaddr in __allocate_data_blocks

In __allocate_data_blocks, we should check current blkaddr which is located at
ofs_in_node of dnode page instead of checking first blkaddr all the time.
Otherwise we can only allocate one blkaddr in each dnode page. Fix it.
Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 0bfcfcca
...@@ -1066,7 +1066,10 @@ static void __allocate_data_blocks(struct inode *inode, loff_t offset, ...@@ -1066,7 +1066,10 @@ static void __allocate_data_blocks(struct inode *inode, loff_t offset,
end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode)); end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode));
while (dn.ofs_in_node < end_offset && len) { while (dn.ofs_in_node < end_offset && len) {
if (dn.data_blkaddr == NULL_ADDR) { block_t blkaddr;
blkaddr = datablock_addr(dn.node_page, dn.ofs_in_node);
if (blkaddr == NULL_ADDR) {
if (__allocate_data_block(&dn)) if (__allocate_data_block(&dn))
goto sync_out; goto sync_out;
allocated = true; allocated = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment