ext4: Use -1 as the fake block number for delayed new buffer_head
PATCH 1/2 ext4: Use -1 as the fake block number for delayed new buffer_head
Block number '0' should not be used as the fake block number for
the delayed new buffer. This will result in vfs calling umap_underlying_metadata for block number '0'. So use -1 instead.
--- fs/ext4/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ext4/inode.c +1 -1
@@ -2318,7 +2318,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,/* not enough space to reserve */ return ret; -map_bh (bh_result, inode->i_sb,0 ); +map_bh (bh_result, inode->i_sb,-1 );set_buffer_new (bh_result);set_buffer_delay (bh_result); }else if (ret >0 ) {
Signature · 1 line
tg: (56a50ad..) ext4_corruption_fix (depends on: master)
PATCH 2/2 ext4: Mark the unwritten buffer_head mapped during write_begin
This avoid multiple get_block calls during write. Now that we have unwritten buffer marked as mapped, we need to make sure writepages will handle unwritten buffer_heads also.
With this patch we have the below:
ext4_ext_get_block returns unmapped, unwritten, buffer head when called with create = 0 for prealloc space. This make sure we handle the read path and non delalloc case correctly. Even though the buffer head is marked unmapped we have valid b_blocknr and b_bdev values in the buffer_head.
ext4_da_get_block_prep called for block resrevation will now return mapped, unwritten, new buffer_head for prealloc space. This make sure we don't do multiple get_block calls for write to same offset. Also marking it new make sure sub-block zeroing of buffered writes happen correctly.
--- fs/ext4/extents.c | 6 +++- fs/ext4/inode.c | 78 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 26 deletions(-)
fs/ext4/extents.c +4 -2
@@ -2865,6 +2865,8 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,if (create ==EXT4_CREATE_UNINITIALIZED_EXT ) goto out;if (!create) { +if (allocated > max_blocks) + allocated = max_blocks;/* * We have blocks reserved already. We * return allocated blocks so that delalloc
@@ -2872,9 +2874,9 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,* the buffer head will be unmapped so that * a read from the block returns 0s. */ -if (allocated > max_blocks) - allocated = max_blocks;set_buffer_unwritten (bh_result); + bh_result->b_bdev = inode->i_sb->s_bdev; + bh_result->b_blocknr = newblock; goto out2; }
fs/ext4/inode.c +53 -22
121 lines not on this page · raw message
Theodore Tso
maintainerYou mean "for 2.6.30", right?
- Ted
Quoted 2 lines · Theodore Tso
You mean "for 2.6.30", right?
The reason for me to post two series one for 2.6.30 and other for 2.6.31 was the [Patch 2/2] for 2.6.31 needs more testing. I added this specific patch in both the series to make sure we don't miss the change in case we decided not to make any changes for 2.6.30. Also in my testing I created different topgit branches with different dependencies. So having [PATCH 1/2 ] in both the series helped in testing with topgit branches.
-aneesh
Theodore Tso
maintainerQuoted 10 lines · Aneesh Kumar K.V
Quoted 2 lines · Theodore Tso
You mean "for 2.6.30", right?
The reason for me to post two series one for 2.6.30 and other for 2.6.31 was the [Patch 2/2] for 2.6.31 needs more testing. I added this specific patch in both the series to make sure we don't miss the change in case we decided not to make any changes for 2.6.30. Also in my testing I created different topgit branches with different dependencies. So having [PATCH 1/2 ] in both the series helped in testing with topgit branches.
Yeah, but you didn't label the other series as "for 2.6.30". To makes matter worse, the fact that patch #2 in what I think is your 2.6.30 patch series (the V4 series?) is the same as patch #1 of your 2.6.31 series, and your "2.6.31" series doesn't have a patch backing out the 2.6.30 changes (I assume you need to do that, right?), left me as a very confused maintainer about.
OK, so what I have in the patch queue is the V4 version, somewhat modified, and I'll ignore the "for 2.6.31" patches for now. When you're ready, please send me patches versus the end of the stable series of the ext4 patch queue, and please give me this kind of context.
If you could verify what's in the patch queue, I'd appreciate it.
Thanks,
- Ted