linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Shaohua Li <shli@fusionio.com>, Neil Brown <neilb@suse.de>,
	Ingo Molnar <mingo@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [boot crash] Re: [GIT PULL[ block drivers bits for 3.8
Date: Wed, 19 Dec 2012 15:47:15 +0100	[thread overview]
Message-ID: <50D1D373.5060301@kernel.dk> (raw)
In-Reply-To: <CA+55aFzhfknCd-JERhrDfkOhdm_eytoVBYA42ex2K+BghBaBKQ@mail.gmail.com>

On 2012-12-18 17:49, Linus Torvalds wrote:
> On Tue, Dec 18, 2012 at 3:42 AM, Jens Axboe <axboe@kernel.dk> wrote:
>>
>> Bah. Does the below fix it up for you?
> 
> Grr. This is still bullshit.
> 
> Doing this:
> 
>     alignment = sector << 9;
> 
> is fundamentally crap, because 'sector_t' may well be 32-bit
> (non-large-block device case). And we're supposed (surprise surprise)
> to be able to handle devices larger than 4GB in size.
> 
> So doing *any* of these calculations in bytes is pure and utter crap.
> You need to do them in sectors. That's what "sector_t" means, and
> that's damn well how everything should work. Anything that works in
> bytes is simply pure crap. And don't talk to me about 64-bit math and
> doing it in "u64" or "loff_t", that's just utterly moronic too.
> 
> Besides, "sector_div()" is only sensible when you're looking for the
> remainder of a sector number. That's true in the first case (sector
> really is a sector number - it's the starting sector of the
> partition), but the source of alignment and granularity are actually
> just "unsigned int" (and that's in bytes, not sectors), so using
> sector_t afterwards is crazy too. You should have used just '%'.
> Looking around, there are other places where this idiocy happens too
> (blkdev_issue_discard() seems to think the granularity/alignments are
> sector_t's too, for example).
> 
> Anyway, here's a patch to fix the crazy types and the bogus second
> "sector_div()". It's whitespace-damaged, because not only have I not
> tested it, I also think somebody needs to look at things in general.
> The whole "discard_alignment" handling is extremely odd. I don't think
> it should be called "alignment" at all - because it isn't. It's an
> alignment *offset*. Look at the normal (non-discard) case, where it's
> called "alignment_offset" like it should be.
> 
> So the math is confused, the types are confused, and the naming is
> confused. Please, somebody check this out, because now *I* am
> confused.

It should all just be in sectors. The limits set are in bytes (could be
sectors too, but doesn't matter so much), but any interface operates in
sectors.

I'm happy with your proposed fix. I think you should shove it in there,
then I'll make sure we get it cleaned up for 3.9.

> And btw, that whole commit happened too f*cking late too. When I get a
> pull request, it should damn well have been tested already, and it
> should have been developed *before* the merge window started. Not the
> day before the pull request.

Of course it's been tested. Granted it got moved over too late (as 1 of
2 that did), but I've run the branch on a multitude of systems.
Apparently none of them hit the case of having a zero granularity
reported, so never hit the bug.

-- 
Jens Axboe


  reply	other threads:[~2012-12-19 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 21:08 [GIT PULL[ block drivers bits for 3.8 Jens Axboe
2012-12-18  9:25 ` [boot crash] " Ingo Molnar
2012-12-18 11:42   ` Jens Axboe
2012-12-18 16:49     ` Linus Torvalds
2012-12-19 14:47       ` Jens Axboe [this message]
2012-12-19 16:29         ` Linus Torvalds
2012-12-19 17:53           ` Doug Anderson
2012-12-19 18:10           ` Jens Axboe

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=50D1D373.5060301@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=neilb@suse.de \
    --cc=shli@fusionio.com \
    --cc=torvalds@linux-foundation.org \
    /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).