All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Dan Williams <dan.j.williams@intel.com>,
	Song Liu <songliubraving@fb.com>
Cc: linux-raid <linux-raid@vger.kernel.org>, Shaohua Li <shli@fb.com>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH 5/6] Check write journal in incremental
Date: Mon, 19 Oct 2015 13:32:34 +1100	[thread overview]
Message-ID: <87io63lha5.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAPcyv4iYxLm1uoHM1Rrz7jyecrf+8Luby8CjmQwdK0Pvs6Ya+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3500 bytes --]

Dan Williams <dan.j.williams@intel.com> writes:

> On Fri, Aug 28, 2015 at 4:27 PM, Song Liu <songliubraving@fb.com> wrote:
>> If journal device is missing, do not start the array, and shows:
>>
>> ./mdadm -I /dev/sdf
>> mdadm: journal device is missing, not safe to start yet.
>>
>> The array will be started when the journal device is attached with -I
>>
>> ./mdadm -I /dev/sdb1
>> mdadm: /dev/sdb1 attached to /dev/md/0_0, which has been started.
>>
>> To force start without journal device:
>>
>> ./mdadm -I /dev/sdf --run
>> mdadm: Trying to run with missing journal device
>> mdadm: /dev/sdf attached to /dev/md/0_0, which has been started.
>>
>> Signed-off-by: Shaohua Li <shli@fb.com>
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> ---
>>  Incremental.c | 31 +++++++++++++++++++++++++++----
>>  1 file changed, 27 insertions(+), 4 deletions(-)
>>
>> diff --git a/Incremental.c b/Incremental.c
>> index 304cc6d..74905e3 100644
>> --- a/Incremental.c
>> +++ b/Incremental.c
>> @@ -35,7 +35,7 @@
>>
>>  static int count_active(struct supertype *st, struct mdinfo *sra,
>>                         int mdfd, char **availp,
>> -                       struct mdinfo *info);
>> +                       struct mdinfo *info, int *journal_device_missing);
>>  static void find_reject(int mdfd, struct supertype *st, struct mdinfo *sra,
>>                         int number, __u64 events, int verbose,
>>                         char *array_name);
>> @@ -104,6 +104,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
>>         struct map_ent target_array;
>>         int have_target;
>>         char *devname = devlist->devname;
>> +       int journal_device_missing = 0;
>>
>>         struct createinfo *ci = conf_get_create_info();
>>
>> @@ -518,7 +519,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
>>         sysfs_free(sra);
>>         sra = sysfs_read(mdfd, NULL, (GET_DEVS | GET_STATE |
>>                                     GET_OFFSET | GET_SIZE));
>> -       active_disks = count_active(st, sra, mdfd, &avail, &info);
>> +       active_disks = count_active(st, sra, mdfd, &avail, &info, &journal_device_missing);
>>         if (enough(info.array.level, info.array.raid_disks,
>>                    info.array.layout, info.array.state & 1,
>>                    avail) == 0) {
>> @@ -548,10 +549,12 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
>>         }
>>
>>         map_unlock(&map);
>> -       if (c->runstop > 0 || active_disks >= info.array.working_disks) {
>> +       if (c->runstop > 0 || (!journal_device_missing && active_disks >= info.array.working_disks)) {
>
> A minor comment, and I'd defer to Neil's opinion, but I think this is
> asking for mdu_array_info_t to grow a "journal_disks" attribute.

We definitely don't want to change mdu_array_info_t - that is part of
the kernel api.
But adding a 'journal_disks' field to 'struct mdinfo' might make sense.

Similarly, now that I look at it, the 'require_journal' method doesn't
look like such a good idea.
->getinfo_super should set some flag in 'struct mdinfo' if a journal is
required.

The Incremental() function might still have a local var called
journal_device_missing, but it wouldn't pass it to count_active().
count_active would just set ->journal_disks and then Incrmental would do
something like:

journal_device_missing = info.journal_needed && info.journal_disks == 0;

Song: can you see if making some changes like that works out?

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2015-10-19  2:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 23:27 [PATCH 0/6] mdadm support for journal device of RAID-4/5/6 Song Liu
2015-08-28 23:27 ` [PATCH 1/6] add macros for MD_DISK_ROLE_(SPARE/FAULTY) Song Liu
2015-08-28 23:27 ` [PATCH 2/6] Show device as journal in --detail --examine Song Liu
2015-09-02  6:53   ` Christoph Hellwig
2015-09-02  7:04     ` Song Liu
2015-09-02  7:07       ` Christoph Hellwig
2015-09-02  7:09         ` Song Liu
2015-08-28 23:27 ` [PATCH 3/6] Enable create array with write journal (--write-journal DEVICE) Song Liu
2015-10-06 18:32   ` Dan Williams
2015-10-07  6:06     ` Song Liu
2015-10-19  2:42       ` Neil Brown
2015-08-28 23:27 ` [PATCH 4/6] Assemble array with write journal Song Liu
2015-10-06 20:11   ` Dan Williams
2015-10-07  6:13     ` Song Liu
2015-08-28 23:27 ` [PATCH 5/6] Check write journal in incremental Song Liu
2015-10-06 20:17   ` Dan Williams
2015-10-19  2:32     ` Neil Brown [this message]
2015-08-28 23:27 ` [PATCH 6/6] Add help message and man entry for --write-journal Song Liu

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=87io63lha5.fsf@notabene.neil.brown.name \
    --to=neilb@suse.de \
    --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 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.