All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/9] btrfs: Simplify metadata pages reading
Date: Mon, 14 Sep 2020 19:01:04 +0800	[thread overview]
Message-ID: <cffbc9ba-f63c-77ea-1516-da4da7043db3@gmx.com> (raw)
In-Reply-To: <20200914093711.13523-3-nborisov@suse.com>



On 2020/9/14 下午5:37, Nikolay Borisov wrote:
> Metadata pages currently use __do_readpage to read metadata pages,
> unfortunately this function is also used to deal with ordinary data
> pages. This makes the metadata pages reading code to go through multiple
> hoops in order to adhere to __do_readpage invariants. Most of these are
> necessary for data pages which could be compressed. For metadata it's
> enough to simply build a bio and submit it.
>
> To this effect simply call submit_extent_page directly from
> read_extent_buffer_pages which is the only callpath used to populate
> extent_buffers with data. This in turn enables further cleanups.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>  fs/btrfs/extent_io.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index a1e070ec7ad8..0a6cda4c30ed 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -5573,20 +5573,19 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num)
>  			}
>
>  			ClearPageError(page);
> -			err = __extent_read_full_page(page,
> -						      btree_get_extent, &bio,
> -						      mirror_num, &bio_flags,
> -						      REQ_META);
> +			err = submit_extent_page(REQ_OP_READ | REQ_META, NULL,
> +					 page, page_offset(page), PAGE_SIZE, 0,
> +					 &bio, end_bio_extent_readpage,
> +					 mirror_num, 0, 0, false);
>  			if (err) {
> -				ret = err;
>  				/*
> -				 * We use &bio in above __extent_read_full_page,
> -				 * so we ensure that if it returns error, the
> -				 * current page fails to add itself to bio and
> -				 * it's been unlocked.
> -				 *
> -				 * We must dec io_pages by ourselves.
> +				 * We failed to submit the bio so it's the
> +				 * caller's responsibility to perform cleanup
> +				 * i.e unlock page/set error bit.
>  				 */
> +				ret = err;
> +				SetPageError(page);
> +				unlock_page(page);
>  				atomic_dec(&eb->io_pages);
>  			}
>  		} else {
>

  reply	other threads:[~2020-09-14 11:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14  9:37 [PATCH v2 0/9] Cleanup metadata page reading path Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 1/9] btrfs: Remove btree_readpage Nikolay Borisov
2020-09-14 10:51   ` Qu Wenruo
2020-09-14  9:37 ` [PATCH v2 2/9] btrfs: Simplify metadata pages reading Nikolay Borisov
2020-09-14 11:01   ` Qu Wenruo [this message]
2020-09-14  9:37 ` [PATCH v2 3/9] btrfs: Remove btree_get_extent Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 4/9] btrfs: Remove btrfs_get_extent indirection from __do_readpage Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 5/9] btrfs: Remove mirror_num argument from extent_read_full_page Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 6/9] btrfs: Promote extent_read_full_page to btrfs_readpage Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 7/9] btrfs: Sink mirror_num argument in extent_read_full_page Nikolay Borisov
2020-09-14 10:35   ` Johannes Thumshirn
2020-09-14 10:38     ` Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 8/9] btrfs: Sink read_flags argument into extent_read_full_page Nikolay Borisov
2020-09-14  9:37 ` [PATCH v2 9/9] btrfs: Sink mirror_num argument in __do_readpage Nikolay Borisov
2020-09-14 10:39 ` [PATCH v2 0/9] Cleanup metadata page reading path Johannes Thumshirn
2020-09-14 11:39   ` Nikolay Borisov
2020-09-14 11:44     ` Johannes Thumshirn
2020-09-14 11:39 ` [PATCH] btrfs: Opencode extent_read_full_page to its sole caller Nikolay Borisov
2020-09-14 11:45   ` Johannes Thumshirn
2020-09-15  7:44   ` David Sterba
2020-09-15  7:43 ` [PATCH v2 0/9] Cleanup metadata page reading path 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=cffbc9ba-f63c-77ea-1516-da4da7043db3@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@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.