Commit 27e6c7a3 authored by Ryusuke Konishi's avatar Ryusuke Konishi

nilfs2: mark buffer heads as delayed until the data is written to disk

Nilfs does not allocate new blocks on disk until they are actually
written to.  To implement fiemap, we need to deal with such blocks.

To allow successive fiemap patch to distinguish mapped but unallocated
regions, this marks buffer heads of those new blocks as delayed and
clears the flag after the blocks are written to disk.
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
parent e828949e
...@@ -104,6 +104,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, ...@@ -104,6 +104,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
nilfs_transaction_commit(inode->i_sb); /* never fails */ nilfs_transaction_commit(inode->i_sb); /* never fails */
/* Error handling should be detailed */ /* Error handling should be detailed */
set_buffer_new(bh_result); set_buffer_new(bh_result);
set_buffer_delay(bh_result);
map_bh(bh_result, inode->i_sb, 0); /* dbn must be changed map_bh(bh_result, inode->i_sb, 0); /* dbn must be changed
to proper value */ to proper value */
} else if (ret == -ENOENT) { } else if (ret == -ENOENT) {
......
...@@ -1763,6 +1763,7 @@ static void nilfs_clear_copied_buffers(struct list_head *list, int err) ...@@ -1763,6 +1763,7 @@ static void nilfs_clear_copied_buffers(struct list_head *list, int err)
if (!err) { if (!err) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
clear_buffer_delay(bh);
clear_buffer_nilfs_volatile(bh); clear_buffer_nilfs_volatile(bh);
} }
brelse(bh); /* for b_assoc_buffers */ brelse(bh); /* for b_assoc_buffers */
...@@ -1889,6 +1890,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) ...@@ -1889,6 +1890,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
b_assoc_buffers) { b_assoc_buffers) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
clear_buffer_delay(bh);
clear_buffer_nilfs_volatile(bh); clear_buffer_nilfs_volatile(bh);
clear_buffer_nilfs_redirected(bh); clear_buffer_nilfs_redirected(bh);
if (bh == segbuf->sb_super_root) { if (bh == segbuf->sb_super_root) {
......
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