All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 3/5] btrfs: extent_io: Kill the BUG_ON() in flush_write_bio()
Date: Tue, 22 Jan 2019 18:38:56 +0100	[thread overview]
Message-ID: <20190122173856.GQ2900@twin.jikos.cz> (raw)
In-Reply-To: <20190118021956.22949-4-wqu@suse.com>

On Fri, Jan 18, 2019 at 10:19:54AM +0800, Qu Wenruo wrote:
> This BUG_ON() is really just a crappy way to workaround the _must_check
> attribute of submit_one_bio().
> 
> Now kill the BUG_ON() and allow flush_write_bio() to return error
> number.
> 
> Also add _must_check attribute to flush_write_bio(), and modify all
> callers to handle the possible error returned.

Can you please spit that to several steps:

1. handle errors in submit_one_bio or pass it to the callers
   ie. drop the BUG_ON and move it to all callers

2. in all callers do
   ret = flush_write_bio(...)
   BUG_ON(ret)

So now it's one level up in the call chain and up to all callers to
handle the errors properly. The code is equivalent to the previous
state, though there are more BUG_ONs.

3. one patch per function that handles errors of flush_write_bio, ie.
   actual replacement of BUG_ON with if (ret < 0) etc

As there are several different functions, each has own things to clean
up and it's easier to review them one by one. Sometimes it's necessary
to check more callers and keeping multiple contexts in mind at once does
not work very well.

Counting all the affected functions:

lock_extent_buffer_for_io(struct extent_buffer *eb,
btree_write_cache_pages(struct address_space *mapping,
extent_write_cache_pages(struct address_space *mapping,
extent_write_full_page(struct page *page, struct writeback_control *wbc)
extent_write_locked_range(struct inode *inode, u64 start, u64 end,
extent_writepages(struct address_space *mapping,

the 3rd point would produce 6 patches.

  reply	other threads:[~2019-01-22 17:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18  2:19 [PATCH v3 0/5] btrfs: Enhancement to tree block validation Qu Wenruo
2019-01-18  2:19 ` [PATCH v3 1/5] btrfs: Always output error message when key/level verification fails Qu Wenruo
2019-01-18  7:38   ` Johannes Thumshirn
2019-01-18  2:19 ` [PATCH v3 2/5] btrfs: extent_io: Kill the forward declaration of flush_write_bio() Qu Wenruo
2019-01-18  2:19 ` [PATCH v3 3/5] btrfs: extent_io: Kill the BUG_ON() in flush_write_bio() Qu Wenruo
2019-01-22 17:38   ` David Sterba [this message]
2019-01-18  2:19 ` [PATCH v3 4/5] btrfs: disk-io: Show the timing of corrupted tree block explicitly Qu Wenruo
2019-01-18  7:39   ` Johannes Thumshirn
2019-01-18  2:19 ` [PATCH v3 5/5] btrfs: Do mandatory tree block check before submitting bio Qu Wenruo
2019-01-18  7:48   ` Johannes Thumshirn
2019-01-22 17:47 ` [PATCH v3 0/5] btrfs: Enhancement to tree block validation David Sterba
2019-01-22 22:53   ` Qu Wenruo
2019-01-23 17:16 ` David Sterba
2019-01-24  0:08   ` Qu Wenruo
2019-01-24  3:04   ` Qu Wenruo
2019-01-24 15:20     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190122173856.GQ2900@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.