From: Neil Brown <neilb@suse.de>
To: Shaohua Li <shli@fb.com>
Cc: linux-raid@vger.kernel.org, Kernel-team@fb.com,
songliubraving@fb.com, hch@infradead.org,
dan.j.williams@intel.com
Subject: Re: [PATCH v3 1/8] MD: add a new disk role to present cache device
Date: Thu, 18 Jun 2015 09:32:26 +1000 [thread overview]
Message-ID: <20150618093226.380ba7f5@home.neil.brown.name> (raw)
In-Reply-To: <d93a4bc7511c04c39914eebe70816ca671a362ea.1433356864.git.shli@fb.com>
On Wed, 3 Jun 2015 15:48:36 -0700
Shaohua Li <shli@fb.com> wrote:
> From: Song Liu <songliubraving@fb.com>
>
> Next patches will use a disk as raid5/6 caching. We need a new disk role
> to present the cache device
>
> Not sure if we should bump up the MD superblock version for the disk
> role.
No need to increase the superblock version, but you would need to add a
feature flag (for feature_map) which was set whenever the array had a
caching device.
NeilBrown
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> drivers/md/md.c | 14 +++++++++++++-
> drivers/md/md.h | 4 ++++
> include/uapi/linux/raid/md_p.h | 1 +
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 2750630..6297087 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1656,6 +1656,9 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
> case 0xfffe: /* faulty */
> set_bit(Faulty, &rdev->flags);
> break;
> + case 0xfffd: /* cache device */
> + set_bit(WriteCache, &rdev->flags);
> + break;
> default:
> rdev->saved_raid_disk = role;
> if ((le32_to_cpu(sb->feature_map) &
> @@ -1811,6 +1814,8 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
> sb->dev_roles[i] = cpu_to_le16(0xfffe);
> else if (test_bit(In_sync, &rdev2->flags))
> sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
> + else if (test_bit(WriteCache, &rdev2->flags))
> + sb->dev_roles[i] = cpu_to_le16(0xfffd);
> else if (rdev2->raid_disk >= 0)
> sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
> else
> @@ -5780,7 +5785,8 @@ static int get_disk_info(struct mddev *mddev, void __user * arg)
> else if (test_bit(In_sync, &rdev->flags)) {
> info.state |= (1<<MD_DISK_ACTIVE);
> info.state |= (1<<MD_DISK_SYNC);
> - }
> + } else if (test_bit(WriteCache, &rdev->flags))
> + info.state |= (1<<MD_DISK_WRITECACHE);
> if (test_bit(WriteMostly, &rdev->flags))
> info.state |= (1<<MD_DISK_WRITEMOSTLY);
> } else {
> @@ -5895,6 +5901,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
> else
> clear_bit(WriteMostly, &rdev->flags);
>
> + if (info->state & (1<<MD_DISK_WRITECACHE))
> + set_bit(WriteCache, &rdev->flags);
> /*
> * check whether the device shows up in other nodes
> */
> @@ -7263,6 +7271,10 @@ static int md_seq_show(struct seq_file *seq, void *v)
> seq_printf(seq, "(F)");
> continue;
> }
> + if (test_bit(WriteCache, &rdev->flags)) {
> + seq_printf(seq, "(C)");
> + continue;
> + }
> if (rdev->raid_disk < 0)
> seq_printf(seq, "(S)"); /* spare */
> if (test_bit(Replacement, &rdev->flags))
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 4046a6c..6857592 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -175,6 +175,10 @@ enum flag_bits {
> * This device is seen locally but not
> * by the whole cluster
> */
> + WriteCache, /* This device is used as write cache.
> + * Usually, this device should be faster
> + * than other devices in the array
> + */
> };
>
> #define BB_LEN_MASK (0x00000000000001FFULL)
> diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h
> index 2ae6131..9d36b91 100644
> --- a/include/uapi/linux/raid/md_p.h
> +++ b/include/uapi/linux/raid/md_p.h
> @@ -89,6 +89,7 @@
> * read requests will only be sent here in
> * dire need
> */
> +#define MD_DISK_WRITECACHE 18 /* disk is used as the write cache in RAID-5/6 */
>
> typedef struct mdp_device_descriptor_s {
> __u32 number; /* 0 Device number in the entire set */
next prev parent reply other threads:[~2015-06-17 23:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 22:48 [PATCH v3 0/8] MD: a caching layer for raid5/6 Shaohua Li
2015-06-03 22:48 ` [PATCH v3 1/8] MD: add a new disk role to present cache device Shaohua Li
2015-06-17 23:32 ` Neil Brown [this message]
2015-06-03 22:48 ` [PATCH v3 2/8] raid5: directly use mddev->queue Shaohua Li
2015-06-03 22:48 ` [PATCH v3 4/8] raid5: add some sysfs entries Shaohua Li
2015-06-03 22:48 ` [PATCH v3 5/8] md: don't allow resize/reshape with cache support Shaohua Li
2015-06-18 1:16 ` Neil Brown
2015-06-03 22:48 ` [PATCH v3 6/8] raid5: skip resync if caching is enabled Shaohua Li
2015-06-03 22:48 ` [PATCH v3 7/8] raid5: guarantee cache release stripes in correct way Shaohua Li
2015-06-03 22:48 ` [PATCH v3 8/8] raid5: multi-thread support for raid5 caching reclaim Shaohua Li
2015-06-04 19:29 ` Fwd: [PATCH v3 0/8] MD: a caching layer for raid5/6 Davor Vusir
[not found] ` <c6df8779f11a4dc3362a04e7cee0be2aec213ebe.1433356864.git.shli@fb.com>
2015-06-18 1:00 ` [PATCH v3 3/8] raid5: A caching layer for RAID5/6 Neil Brown
2015-06-18 5:24 ` Shaohua Li
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=20150618093226.380ba7f5@home.neil.brown.name \
--to=neilb@suse.de \
--cc=Kernel-team@fb.com \
--cc=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=shli@fb.com \
--cc=songliubraving@fb.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 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).