From: Anand Jain <anand.jain@oracle.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 02/22] btrfs: assume that prev_em_start is always valid in __do_readpage
Date: Tue, 13 Mar 2018 23:03:31 +0800 [thread overview]
Message-ID: <46bf43fc-6fd2-3199-9b5d-3bbb768bba2f@oracle.com> (raw)
In-Reply-To: <f92bec1a7defa40fe7c51a4d570e45f419d0c9df.1520518876.git.dsterba@suse.com>
On 03/08/2018 10:33 PM, David Sterba wrote:
> All callers pass a valid pointer, we can remove the redundant checks.
>
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/extent_io.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index d00d5a59ff21..36514baa661e 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2875,6 +2875,8 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset,
> * handlers)
> * XXX JDM: This needs looking at to ensure proper page locking
> * return 0 on success, otherwise return error
> + *
> + * @prev_em_start: return value of previous em start value; must be valid
> */
> static int __do_readpage(struct extent_io_tree *tree,
> struct page *page,
> @@ -2903,6 +2905,8 @@ static int __do_readpage(struct extent_io_tree *tree,
> size_t blocksize = inode->i_sb->s_blocksize;
> unsigned long this_bio_flag = 0;
>
> + ASSERT(prev_em_start);
> +
mount is failing with this patch as in this stack below the
prev_em_start is NULL.
--------
static int __extent_read_full_page(struct extent_io_tree *tree,
struct page *page,
get_extent_t *get_extent,
struct bio **bio, int mirror_num,
unsigned long *bio_flags,
unsigned int read_flags)
{
::
ret = __do_readpage(tree, page, get_extent, NULL, bio, mirror_num,
bio_flags, read_flags, NULL);
----------
kernel: assertion failed: prev_em_start, file: fs/btrfs/extent_io.c,
line: 2911
kernel: ------------[ cut here ]------------
kernel: kernel BUG at fs/btrfs/ctree.h:3462!
kernel: __do_readpage+0x7f/0x7e0 [btrfs]
kernel: ? btree_fs_info+0x20/0x20 [btrfs]
kernel: ? mark_held_locks+0x65/0x80
kernel: ? _raw_spin_unlock_irq+0x29/0x40
kernel: __extent_read_full_page+0xe7/0x100 [btrfs]
kernel: ? btree_fs_info+0x20/0x20 [btrfs]
kernel: read_extent_buffer_pages+0x1af/0x2b0 [btrfs]
kernel: btree_read_extent_buffer_pages+0x4f/0xe0 [btrfs]
kernel: read_tree_block+0x31/0x60 [btrfs]
kernel: ? __raw_spin_lock_init+0x2d/0x50
kernel: open_ctree+0x19a2/0x25f0 [btrfs]
kernel: btrfs_mount_root+0x465/0x720 [btrfs]
kernel: ? __lockdep_init_map+0xb6/0x1d0
kernel: ? mount_fs+0x89/0x130
kernel: ? __init_waitqueue_head+0x36/0x50
kernel: mount_fs+0x89/0x130
kernel: vfs_kern_mount+0x69/0x160
---------
Thanks, Anand
> set_page_extent_mapped(page);
>
> end = page_end;
> @@ -3012,12 +3016,11 @@ static int __do_readpage(struct extent_io_tree *tree,
> * non-optimal behavior (submitting 2 bios for the same extent).
> */
> if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) &&
> - prev_em_start && *prev_em_start != (u64)-1 &&
> + *prev_em_start != (u64)-1 &&
> *prev_em_start != em->orig_start)
> force_bio_submit = true;
>
> - if (prev_em_start)
> - *prev_em_start = em->orig_start;
> + *prev_em_start = em->orig_start;
>
> free_extent_map(em);
> em = NULL;
>
next prev parent reply other threads:[~2018-03-13 15:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 14:33 [PATCH 00/22] Misc cleanups David Sterba
2018-03-08 14:33 ` [PATCH 01/22] btrfs: assume that bio_ret is always valid in submit_extent_page David Sterba
2018-03-08 14:33 ` [PATCH 02/22] btrfs: assume that prev_em_start is always valid in __do_readpage David Sterba
2018-03-13 15:03 ` Anand Jain [this message]
2018-03-16 16:12 ` David Sterba
2018-03-08 14:33 ` [PATCH 03/22] btrfs: remove redundant variable " David Sterba
2018-03-08 14:33 ` [PATCH 04/22] btrfs: cleanup merging conditions in submit_extent_page David Sterba
2018-03-08 14:33 ` [PATCH 05/22] btrfs: document more parameters of submit_extent_page David Sterba
2018-03-08 14:33 ` [PATCH 06/22] btrfs: drop fs_info parameter from tree_mod_log_set_node_key David Sterba
2018-03-08 14:33 ` [PATCH 07/22] btrfs: drop fs_info parameter from tree_mod_log_insert_move David Sterba
2018-03-08 14:33 ` [PATCH 08/22] btrfs: drop fs_info parameter from tree_mod_log_insert_key David Sterba
2018-03-08 14:33 ` [PATCH 09/22] btrfs: drop fs_info parameter from tree_mod_log_free_eb David Sterba
2018-03-08 14:33 ` [PATCH 10/22] " David Sterba
2018-03-08 14:33 ` [PATCH 11/22] btrfs: drop unused fs_info parameter from tree_mod_log_eb_move David Sterba
2018-03-08 14:33 ` [PATCH 12/22] btrfs: embed tree_mod_move structure to tree_mod_elem David Sterba
2018-03-08 14:33 ` [PATCH 13/22] btrfs: drop fs_info parameter from __tree_mod_log_oldest_root David Sterba
2018-03-08 14:33 ` [PATCH 14/22] btrfs: remove trivial locking wrappers of tree mod log David Sterba
2018-03-08 15:37 ` Nikolay Borisov
2018-03-08 15:56 ` David Sterba
2018-03-08 14:33 ` [PATCH 15/22] btrfs: kill trivial wrapper tree_mod_log_eb_move David Sterba
2018-03-08 14:33 ` [PATCH 16/22] btrfs: kill tree_mod_log_set_node_key helper David Sterba
2018-03-08 14:33 ` [PATCH 17/22] btrfs: kill tree_mod_log_set_root_pointer helper David Sterba
2018-03-08 15:40 ` Nikolay Borisov
2018-03-08 14:33 ` [PATCH 18/22] btrfs: move allocation after simple tests in tree_mod_log_insert_key David Sterba
2018-03-08 15:26 ` Filipe Manana
2018-03-08 15:54 ` David Sterba
2018-03-08 14:33 ` [PATCH 19/22] btrfs: separate types for submit_bio_start and submit_bio_done David Sterba
2018-03-08 14:33 ` [PATCH 20/22] btrfs: remove unused parameters from extent_submit_bio_start_t David Sterba
2018-03-08 14:33 ` [PATCH 21/22] btrfs: remove unused parameters from extent_submit_bio_done_t David Sterba
2018-03-08 14:33 ` [PATCH 22/22] btrfs: rename submit callbacks and drop double underscores 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=46bf43fc-6fd2-3199-9b5d-3bbb768bba2f@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).