mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Jens Axboe <axboe@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: Merging fails reading /dev/uba1
Date: Mon, 21 Feb 2005 12:00:48 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0502211152330.2378@ppc970.osdl.org> (raw)
In-Reply-To: <20050221102431.64de6c6c@localhost.localdomain>



On Mon, 21 Feb 2005, Pete Zaitcev wrote:
> 
> Contiguous pages have nothing to do with it either. I forgot to mention
> that in the first case (whole device), all reads are done with length of
> 4KB, while in the second case (partition), all reads are 512 bytes long.

That's because your partition isn't a full 4kB in size.

So the kernel falls back to 512-byte reads, just because they are the only 
kind that _can_ read the last sector.

> Disk /dev/uba: 1048 MB, 1048576000 bytes

Note: this is a nice multiple of 4kB.

> 64 heads, 32 sectors/track, 1000 cylinders
> Units = cylinders of 2048 * 512 = 1048576 bytes
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/uba1   *           1        1000     1023983+   6  FAT16

And note how this is _not_ (see the "+" at the end), you've got a 
1023983.5 kB partition.

> It does not look to me as if the partition started from an odd number
> of sectors. In fact, it starts from a full number of pages.

But it seems to end in an odd number of sectors.

That said, I'm surprised that the difference in performance is _that_ 
large. Regardless of whether the disk blocksize is 512 bytes or 4096 
bytes, you should be getting IO merging - it might use more CPU time, but 
the actual IO should still be done in much larger blocks.

You should be able to try the BLKBSZSET ioctl to set the blocksize by hand 
if you want to try it out:

	int size = 4096;
	ioctl(fd, BLKBSZSET, &size);

or similar. Of course, mounting a filesystem on the device tends to do 
that (or undo it) for you, ie it will set the blocksize to whatever 
blocksize the filesystem wants.

		Linus

  parent reply	other threads:[~2005-02-21 20:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-21  4:00 Pete Zaitcev
2005-02-21  7:51 ` Jens Axboe
2005-02-21 18:24   ` Pete Zaitcev
2005-02-21 18:31     ` Jeff Garzik
2005-02-21 20:00     ` Linus Torvalds [this message]
2005-02-22  0:41       ` Pete Zaitcev
2005-02-22  1:48         ` Linus Torvalds

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=Pine.LNX.4.58.0502211152330.2378@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zaitcev@redhat.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

all inboxes | Powered by JetHome®