From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: David Sterba <dsterba@suse.cz>,
Nikolay Borisov <nborisov@suse.com>,
Josef Bacik <josef@toxicpanda.com>,
"linux-btrfs @ vger . kernel . org" <linux-btrfs@vger.kernel.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v8 5/8] btrfs: use BIOs instead of buffer_heads from superblock writeout
Date: Fri, 14 Feb 2020 16:02:54 +0100 [thread overview]
Message-ID: <20200214150253.GX2902@twin.jikos.cz> (raw)
In-Reply-To: <20200213152436.13276-6-johannes.thumshirn@wdc.com>
On Fri, Feb 14, 2020 at 12:24:33AM +0900, Johannes Thumshirn wrote:
> + bio = bio_alloc(GFP_NOFS, 1);
> + bio_set_dev(bio, device->bdev);
> + bio->bi_iter.bi_sector = bytenr >> SECTOR_SHIFT;
> + bio->bi_private = device;
> + bio->bi_end_io = btrfs_end_super_write;
> + __bio_add_page(bio, page, BTRFS_SUPER_INFO_SIZE,
> + offset_in_page(bytenr));
>
> /*
> - * we fua the first super. The others we allow
> + * We fua the first super. The others we allow
> * to go down lazy.
> */
> - op_flags = REQ_SYNC | REQ_META | REQ_PRIO;
> + bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_META | REQ_PRIO;
> if (i == 0 && !btrfs_test_opt(device->fs_info, NOBARRIER))
> - op_flags |= REQ_FUA;
> - ret = btrfsic_submit_bh(REQ_OP_WRITE, op_flags, bh);
> - if (ret)
> - errors++;
> + bio->bi_opf |= REQ_FUA;
> +
> + btrfsic_submit_bio(bio);
btrfsic_submit_bh forwards the return values, and could increase error
counter, now btrfsic_submit_bio does not forward submit_bio return
value.
I traced it to generic_make_request, the comment says it does not return
error, so not handling it is ok.
> static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
> for (i = 0; i < max_mirrors; i++) {
> + struct page *page;
> +
> bytenr = btrfs_sb_offset(i);
> if (bytenr + BTRFS_SUPER_INFO_SIZE >=
> device->commit_total_bytes)
> break;
>
> - bh = __find_get_block(device->bdev,
> - bytenr / BTRFS_BDEV_BLOCKSIZE,
> - BTRFS_SUPER_INFO_SIZE);
> - if (!bh) {
> + page = find_get_page(device->bdev->bd_inode->i_mapping,
> + bytenr >> PAGE_SHIFT);
> + if (!page) {
> errors++;
> if (i == 0)
> primary_failed = true;
> continue;
> }
> - wait_on_buffer(bh);
> - if (!buffer_uptodate(bh)) {
> + wait_on_page_locked(page);
And here it's checking the result that could be set by
btrfs_end_super_write (SetPageError). The waiting part is due to the
PG_Locked bit. Please add some comments.
> + if (PageError(page)) {
> errors++;
> if (i == 0)
> primary_failed = true;
> }
>
> /* drop our reference */
> - brelse(bh);
> + put_page(page);
>
> /* drop the reference from the writing run */
> - brelse(bh);
> + put_page(page);
> }
>
> /* log error, force error return */
> --
> 2.24.1
next prev parent reply other threads:[~2020-02-14 15:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 15:24 [PATCH v8 0/8] btrfs: remove buffer heads form superblock handling Johannes Thumshirn
2020-02-13 15:24 ` [PATCH v8 1/8] btrfs: Export btrfs_release_disk_super Johannes Thumshirn
2020-02-13 15:24 ` [PATCH v8 2/8] btrfs: don't kmap() pages from block devices Johannes Thumshirn
2020-02-13 15:24 ` [PATCH v8 3/8] btrfs: reduce scope of btrfs_scratch_superblocks() Johannes Thumshirn
2020-02-18 3:14 ` Anand Jain
2020-02-13 15:24 ` [PATCH v8 4/8] btrfs: use the page-cache for super block reading Johannes Thumshirn
2020-02-14 13:59 ` David Sterba
2020-02-13 15:24 ` [PATCH v8 5/8] btrfs: use BIOs instead of buffer_heads from superblock writeout Johannes Thumshirn
2020-02-14 15:02 ` David Sterba [this message]
2020-02-14 15:08 ` David Sterba
2020-02-14 15:15 ` Johannes Thumshirn
2020-02-18 9:28 ` Anand Jain
2020-02-13 15:24 ` [PATCH v8 6/8] btrfs: remove btrfsic_submit_bh() Johannes Thumshirn
2020-02-18 9:30 ` Anand Jain
2020-02-13 15:24 ` [PATCH v8 7/8] btrfs: remove buffer_heads from btrfsic_process_written_block() Johannes Thumshirn
2020-02-13 15:24 ` [PATCH v8 8/8] btrfs: remove buffer_heads form superblock mirror integrity checking Johannes Thumshirn
2020-02-14 13:53 ` David Sterba
2020-02-14 15:43 ` David Sterba
2020-02-20 15:56 ` [PATCH v8 0/8] btrfs: remove buffer heads form superblock handling 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=20200214150253.GX2902@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.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.