All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: linux-raid@vger.kernel.org
Cc: Song Liu <songliubraving@fb.com>,
	shli@fb.com, kernel-team@fb.com, dan.j.williams@intel.com,
	hch@infradead.org, jes.sorensen@gmail.com
Subject: Re: [PATCH] mdadm: handle super == NULL case in avail_size1
Date: Fri, 01 Sep 2017 09:36:23 +1000	[thread overview]
Message-ID: <87ziafe2dk.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20170831173751.2910909-1-songliubraving@fb.com>

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

On Thu, Aug 31 2017, Song Liu wrote:

> Summary:
>
> Handling super == NULL case in avail_size1() was removed a while
> back. However, it is still useful in the following stack:
>
> avail_size1() with st->sb == NULL
> array_try_spare() with st == NULL
> try_spare() with st == NULL
> Incremental() with st == NULL

I assume you mean "st->sb == NULL" in each case here?  What you have
written doesn't make sense.


>
> This patch adds the handling of super == NULL back to avail_size1().

I doubt this is the best thing to do.
If we don't have st->sb, calling avail_size doesn't make any sense.
Maybe we should be calling validate_geometry.

NeilBrown


>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  super1.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/super1.c b/super1.c
> index f6a1045..5e8d967 100644
> --- a/super1.c
> +++ b/super1.c
> @@ -2340,7 +2340,9 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
>  	if (devsize < 24)
>  		return 0;
>  
> -	if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
> +	if (!super)
> +		bmspace = choose_bm_space(devsize);
> +	else if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
>  		/* hot-add. allow for actual size of bitmap */
>  		struct bitmap_super_s *bsb;
>  		bsb = (struct bitmap_super_s *)(((char*)super)+MAX_SB_SIZE);
> @@ -2350,7 +2352,7 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
>  	}
>  
>  	/* Allow space for bad block log */
> -	if (super->bblog_size)
> +	if (super && super->bblog_size)
>  		bbspace = __le16_to_cpu(super->bblog_size);
>  
>  	if (st->minor_version < 0)
> -- 
> 2.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

  reply	other threads:[~2017-08-31 23:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 17:37 [PATCH] mdadm: handle super == NULL case in avail_size1 Song Liu
2017-08-31 23:36 ` NeilBrown [this message]
2017-08-31 23:46   ` Song Liu
2017-09-01  0:21     ` 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=87ziafe2dk.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=jes.sorensen@gmail.com \
    --cc=kernel-team@fb.com \
    --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.