From: Andre Noll <maan@systemlinux.org>
To: NeilBrown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: [md PATCH 04/22] md: support barrier requests on all personalities.
Date: Tue, 8 Dec 2009 14:54:42 +0100 [thread overview]
Message-ID: <20091208135442.GR5174@skl-net.de> (raw)
In-Reply-To: <20091204064802.10264.60521.stgit@notabene.brown>
[-- Attachment #1: Type: text/plain, Size: 2890 bytes --]
On 17:48, NeilBrown wrote:
> When a barrier arrives, we send a zero-length barrier to every active
> device. When that completes - and if the original request was not
> empty - we submit the barrier request itself (with the barrier flag
> cleared) and the submit a fresh load of zero length barriers.
s/the/then
> +/*
> + * Generic barrier handling for md
> + */
> +
> +static void md_end_barrier(struct bio *bio, int err)
> +{
> + mdk_rdev_t *rdev = bio->bi_private;
> + mddev_t *mddev = rdev->mddev;
> + if (err == -EOPNOTSUPP && mddev->barrier != (void*)1)
How about
#define POST_REQUEST_BARRIER ((void*)1)
?
> + rcu_read_lock();
> + list_for_each_entry_rcu(rdev, &mddev->disks, same_set)
> + if (rdev->raid_disk >= 0 &&
> + !test_bit(Faulty, &rdev->flags)) {
> + /* Take two references, one is dropped
> + * when request finishes, one after
> + * we reclaim rcu_read_lock
> + */
> + struct bio *bi;
> + atomic_inc(&rdev->nr_pending);
> + atomic_inc(&rdev->nr_pending);
> + rcu_read_unlock();
> + bi = bio_alloc(GFP_KERNEL, 0);
> + bi->bi_end_io = md_end_barrier;
> + bi->bi_private = rdev;
> + bi->bi_bdev = rdev->bdev;
> + atomic_inc(&mddev->flush_pending);
> + submit_bio(WRITE_BARRIER, bi);
> + rcu_read_lock();
> + rdev_dec_pending(rdev, mddev);
> + }
> + rcu_read_unlock();
Calling atomic_inc() twice isn't an atomic operation any more. If
this doesn't matter (because all modifications of rdev->nr_pending
are supposed to happen within RCU read-side critical sections) then
why is rdev->nr_pending an atomic_t at all?
> +void md_barrier_request(mddev_t *mddev, struct bio *bio)
> +{
> + mdk_rdev_t *rdev;
> +
> + spin_lock_irq(&mddev->write_lock);
> + wait_event_lock_irq(mddev->sb_wait,
> + !mddev->barrier,
> + mddev->write_lock, /*nothing*/);
> + mddev->barrier = bio;
> + spin_unlock_irq(&mddev->write_lock);
> +
> + atomic_set(&mddev->flush_pending, 1);
> + INIT_WORK(&mddev->barrier_work, md_submit_barrier);
> +
> + rcu_read_lock();
> + list_for_each_entry_rcu(rdev, &mddev->disks, same_set)
> + if (rdev->raid_disk >= 0 &&
> + !test_bit(Faulty, &rdev->flags)) {
> + struct bio *bi;
> +
> + atomic_inc(&rdev->nr_pending);
> + atomic_inc(&rdev->nr_pending);
> + rcu_read_unlock();
> + bi = bio_alloc(GFP_KERNEL, 0);
> + bi->bi_end_io = md_end_barrier;
> + bi->bi_private = rdev;
> + bi->bi_bdev = rdev->bdev;
> + atomic_inc(&mddev->flush_pending);
> + submit_bio(WRITE_BARRIER, bi);
> + rcu_read_lock();
> + rdev_dec_pending(rdev, mddev);
> + }
> + rcu_read_unlock();
This loop is identical to the one above, so it might make sense
to put it into a separate function.
Regards
Andre
--
The only person who always got his work done by Friday was Robinson Crusoe
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2009-12-08 13:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 6:48 [md PATCH 00/22] MD patches queued for 2.6.33 NeilBrown
2009-12-04 6:48 ` [md PATCH 16/22] md/bitmap: update dirty flag when bitmap bits are explicitly set NeilBrown
2009-12-04 6:48 ` [md PATCH 19/22] md: add MODULE_DESCRIPTION for all md related modules NeilBrown
2009-12-04 6:48 ` [md PATCH 22/22] md: integrate spares into array at earliest opportunity NeilBrown
2009-12-04 6:48 ` [md PATCH 13/22] md: support bitmap offset appropriate for external-metadata arrays NeilBrown
2009-12-04 6:48 ` [md PATCH 21/22] md: move compat_ioctl handling into md.c NeilBrown
2009-12-04 6:48 ` [md PATCH 20/22] md: revise Kconfig help for MD_MULTIPATH NeilBrown
2009-12-04 6:48 ` [md PATCH 18/22] raid: improve MD/raid10 handling of correctable read errors NeilBrown
2009-12-04 6:48 ` [md PATCH 06/22] md: add honouring of suspend_{lo,hi} to raid1 NeilBrown
2009-12-04 6:48 ` [md PATCH 12/22] md: remove needless setting of thread->timeout in raid10_quiesce NeilBrown
2009-12-04 6:48 ` [md PATCH 07/22] md/raid1: add takeover support for raid5->raid1 NeilBrown
2009-12-04 6:48 ` [md PATCH 10/22] md: move offset, daemon_sleep and chunksize out of bitmap structure NeilBrown
2009-12-04 6:48 ` [md PATCH 17/22] md/raid10: print more useful messages on device failure NeilBrown
2009-12-04 6:48 ` [md PATCH 15/22] md: Support write-intent bitmaps with externally managed metadata NeilBrown
2009-12-04 6:48 ` [md PATCH 14/22] md: support updating bitmap parameters via sysfs NeilBrown
2009-12-08 10:29 ` Andre Noll
2009-12-10 6:14 ` Neil Brown
2009-12-11 11:46 ` Andre Noll
2009-12-04 6:48 ` [md PATCH 05/22] md/raid5: don't complete make_request on barrier until writes are scheduled NeilBrown
2010-01-21 21:07 ` [md PATCH 05/22] md/raid5: don't complete make_request on barrieruntil " Tirumala Reddy Marri
2010-01-28 2:44 ` Neil Brown
2009-12-04 6:48 ` [md PATCH 03/22] md: don't reset curr_resync_completed after an interrupted resync NeilBrown
2009-12-04 6:48 ` [md PATCH 02/22] md: adjust resync_min usefully when resync aborts NeilBrown
2009-12-04 6:48 ` [md PATCH 04/22] md: support barrier requests on all personalities NeilBrown
2009-12-08 13:54 ` Andre Noll [this message]
2009-12-10 6:25 ` Neil Brown
2009-12-11 11:46 ` Andre Noll
2009-12-04 6:48 ` [md PATCH 09/22] md: collect bitmap-specific fields into one structure NeilBrown
2009-12-04 6:48 ` [md PATCH 01/22] md/bitmap: protect against bitmap removal while being updated NeilBrown
2009-12-04 6:48 ` [md PATCH 11/22] md: change daemon_sleep to be in 'jiffies' rather than 'seconds' NeilBrown
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=20091208135442.GR5174@skl-net.de \
--to=maan@systemlinux.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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).