Message ID | 20190320062749.30953-8-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: tree-checker: Write time tree checker | expand |
On Wed, Mar 20, 2019 at 02:27:45PM +0800, Qu Wenruo wrote: > Do proper cleanup if we hit any error in extent_write_locked_range(), > and check the return value of flush_write_bio(). Yes that's what the code does, but the changelog should explain why this is correct. Same for "btrfs: extent_io: Handle error better in extent_writepages()". You do that in other patches, why not in this one too? If the reason is same for several patches, then copy it, eg. btrfs: "extent_io: Handle errors better in btree_write_cache_pages()" is ok. But don't resend, I'll fix it here as I made some other fixups to changelogs and am finishing the whole series.
On 2019/3/21 下午9:19, David Sterba wrote: > On Wed, Mar 20, 2019 at 02:27:45PM +0800, Qu Wenruo wrote: >> Do proper cleanup if we hit any error in extent_write_locked_range(), >> and check the return value of flush_write_bio(). > > Yes that's what the code does, but the changelog should explain why this > is correct. Same for "btrfs: extent_io: Handle error better in > extent_writepages()". You do that in other patches, why not in this one > too? My bad, I thought the patch implementing end_write_bio() explains why the cleanup function is doing the same work as previous flush_write_bio(), but skipping the bio submitting. So I skipped the reason why calling end_write_bio() here is enough for the error case. > If the reason is same for several patches, then copy it, eg. btrfs: > "extent_io: Handle errors better in btree_write_cache_pages()" is ok. > > But don't resend, I'll fix it here as I made some other fixups to > changelogs and am finishing the whole series. Thank you for the effort and sorry for the inconvenience. Thanks, Qu >
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 4ad7c6afe623..c688049ccfc3 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4077,7 +4077,6 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end, int mode) { int ret = 0; - int flush_ret; struct address_space *mapping = inode->i_mapping; struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; struct page *page; @@ -4110,8 +4109,12 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end, start += PAGE_SIZE; } - flush_ret = flush_write_bio(&epd); - BUG_ON(flush_ret < 0); + ASSERT(ret <= 0); + if (ret < 0) { + end_write_bio(&epd, ret); + return ret; + } + ret = flush_write_bio(&epd); return ret; }
Do proper cleanup if we hit any error in extent_write_locked_range(), and check the return value of flush_write_bio(). Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/extent_io.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)