Util-Linux package development
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: util-linux@vger.kernel.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: optimal io size / custom alignment
Date: Mon, 15 Jun 2015 15:31:54 +0200	[thread overview]
Message-ID: <20150615133154.GV1992@ws.net.home> (raw)
In-Reply-To: <CAGnHSE=gtd2WVcxOBoyfqnp3QtT4RHfK356GHastBbiK5mtmFA@mail.gmail.com>

On Sat, Jun 13, 2015 at 10:52:04PM +0800, Tom Yan wrote:
> As I have mentioned in previous mails, I have an sata/usb3 adapter
> which could work in uas mode, and when it does, it has a weird optimal
> i/o size:
> 
> Disk /dev/sdb: 74.5 GiB, 80026361856 bytes, 156301488 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 33553920 bytes

This is no problem (33553920 % 512 = 0) with the current kernel and
the current util-linux git tree where we support non power of 2
alignment.

> http://www.linuxquestions.org/questions/linux-newbie-8/how-to-foramt-2tb-external-hard-drive-4175529792/
> 
> In the above link, there shows another similar case of an external
> drive with 4k physical sector.

from the link:

    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 33553920 bytes

this is problem (33553920 % 4096 != 0) and frankly it seems like
pretty strange thing, maybe kernel guys can comment it (CC: to
Martin).

> I am not sure if there's anything wrong with the device(s) or the
> kernel, but anyway I doubt if fdisk should determine alignment with
> this size. As you can calculate, it may not necessarily be a multiple
> of the size of physical sectors, or that of common erase block of SSDs
> (which is not reported anywhere AFAIK).
> 
> Perhaps this I/O size does matter on alignment for certain cases, but
> shouldn't physical sector or erase block be at least of higher
> priority when it comes to alignment?

I think we can test "optimal_io_size % physical_sector_size" and use physical
sector size as the granularity if the optimal_io_size is a strange number.

> In any case, it would be nice if fdisk can allow customize alignment
> (like gdisk does), so that users can at least decide how partitions
> should be aligned in weird cases like this. With that, the long-time
> deprecated "dos compatibility" might be able to go as well.

I'll think about it...

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2015-06-15 13:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-13 14:52 optimal io size / custom alignment Tom Yan
2015-06-15 13:31 ` Karel Zak [this message]
2015-06-16  5:20   ` Tom Yan
2015-06-16  5:37     ` Tom Yan
2015-06-16  9:43     ` Karel Zak
2015-06-16 10:22       ` Tom Yan
2015-06-16 17:08     ` Martin K. Petersen
2015-06-16 19:26       ` Tom Yan
2015-06-16 21:28         ` Martin K. Petersen
2015-06-17  9:49           ` Tom Yan
2015-06-18 21:01             ` Martin K. Petersen
2015-06-20 16:01               ` Tom Yan
2015-06-21  0:12                 ` Martin K. Petersen
2015-06-22 14:32                 ` Alan Stern
2015-07-12  4:19   ` optimal io size / custom alignment -- caution on custom aligns Linda Walsh

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=20150615133154.GV1992@ws.net.home \
    --to=kzak@redhat.com \
    --cc=martin.petersen@oracle.com \
    --cc=tom.ty89@gmail.com \
    --cc=util-linux@vger.kernel.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