From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"neilb@suse.com" <neilb@suse.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"jmoyer@redhat.com" <jmoyer@redhat.com>,
"axboe@fb.com" <axboe@fb.com>
Subject: Re: [PATCH v2 1/3] badblocks: Add core badblock management code
Date: Fri, 4 Dec 2015 23:58:44 +0000 [thread overview]
Message-ID: <1449273524.16905.103.camel@intel.com> (raw)
In-Reply-To: <1449271801.27077.25.camel@HansenPartnership.com>
On Fri, 2015-12-04 at 15:30 -0800, James Bottomley wrote:
[...]
> > + * We return
> > + * 0 if there are no known bad blocks in the range
> > + * 1 if there are known bad block which are all acknowledged
> > + * -1 if there are bad blocks which have not yet been acknowledged
> > in metadata.
> > + * plus the start/length of the first bad section we overlap.
> > + */
>
> This comment should be docbook.
Applicable to all your comments - (and they are all valid), I simply
copied over all this from md. I'm happy to make the changes to comments,
and the other two things (see below) if that's the right thing to do --
I just tried to keep my own changes to the original md badblocks code
minimal.
Would it be better (for review-ability) if I made these changes in a new
patch on top of this, or should I just squash them into this one?
>
> > +int badblocks_check(struct badblocks *bb, sector_t s, int sectors,
> > + sector_t *first_bad, int *bad_sectors)
> [...]
> > +
> > +/*
> > + * Add a range of bad blocks to the table.
> > + * This might extend the table, or might contract it
> > + * if two adjacent ranges can be merged.
> > + * We binary-search to find the 'insertion' point, then
> > + * decide how best to handle it.
> > + */
>
> And this one, plus you don't document returns. It looks like this
> function returns 1 on success and zero on failure, which is really
> counter-intuitive for the kernel: zero is usually returned on success
> and negative error on failure.
>
> > +int badblocks_set(struct badblocks *bb, sector_t s, int sectors,
> > + int acknowledged)
> [...]
> > +
> > +/*
> > + * Remove a range of bad blocks from the table.
> > + * This may involve extending the table if we spilt a region,
> > + * but it must not fail. So if the table becomes full, we just
> > + * drop the remove request.
> > + */
>
> Docbook and document returns. This time they're the kernel standard
> of
> 0 on success and negative error on failure making the convention for
> badblocks_set even more counterintuitive.
>
> > +int badblocks_clear(struct badblocks *bb, sector_t s, int sectors)
> > +{
> [...]
> > +#define DO_DEBUG 1
>
> Why have this at all if it's unconditionally defined and always set.
Neil - any reason or anything you had in mind for this? Or is it just an
artifact and can be removed.
>
> > +ssize_t badblocks_store(struct badblocks *bb, const char *page,
> > size_t len,
> > + int unack)
> [...]
> > +int badblocks_init(struct badblocks *bb, int enable)
> > +{
> > + bb->count = 0;
> > + if (enable)
> > + bb->shift = 0;
> > + else
> > + bb->shift = -1;
> > + bb->page = kmalloc(PAGE_SIZE, GFP_KERNEL);
>
> Why not __get_free_page(GFP_KERNEL)? The problem with kmalloc of an
> exactly known page sized quantity is that the slab tracker for this
> requires two contiguous pages for each page because of the overhead.
Cool, I didn't know about __get_free_page - I can fix this up too.
>
> James
>
>
next prev parent reply other threads:[~2015-12-04 23:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 18:43 [PATCH v2 0/3] Badblock tracking for gendisks Vishal Verma
2015-11-25 18:43 ` [PATCH v2 1/3] badblocks: Add core badblock management code Vishal Verma
2015-12-04 23:30 ` James Bottomley
2015-12-04 23:58 ` Verma, Vishal L [this message]
2015-12-05 0:06 ` James Bottomley
2015-12-05 0:11 ` Verma, Vishal L
2015-12-08 21:03 ` NeilBrown
2015-12-08 21:08 ` Verma, Vishal L
2015-12-08 21:18 ` Dan Williams
2015-12-08 23:47 ` Verma, Vishal L
2015-12-22 5:34 ` NeilBrown
2015-12-22 22:13 ` Verma, Vishal L
2015-12-22 23:06 ` NeilBrown
2015-12-23 0:38 ` Verma, Vishal L
2015-11-25 18:43 ` [PATCH v2 2/3] block: Add badblock management for gendisks Vishal Verma
2015-12-04 23:33 ` James Bottomley
2015-12-05 0:17 ` Verma, Vishal L
2015-11-25 18:43 ` [PATCH v2 3/3] md: convert to use the generic badblocks code Vishal Verma
2015-12-01 18:55 ` Shaohua Li
2015-12-01 19:52 ` Verma, Vishal L
2015-12-04 22:53 ` [PATCH v2 0/3] Badblock tracking for gendisks Verma, Vishal L
-- strict thread matches above, loose matches on Subject: below --
2015-12-08 2:52 Vishal Verma
2015-12-08 2:52 ` [PATCH v2 1/3] badblocks: Add core badblock management code Vishal Verma
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=1449273524.16905.103.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@fb.com \
--cc=jmoyer@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=neilb@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 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).