linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Ashish Sangwan <ashishsangwan2@gmail.com>
Cc: tytso@mit.edu, adilger@dilger.ca,
	Namjae Jeon <linkinjeon@gmail.com>,
	linux-ext4@vger.kernel.org
Subject: Re: How to use new "native 4k sector sized" HDD with ext4
Date: Tue, 30 Oct 2012 09:31:13 -0500	[thread overview]
Message-ID: <508FE4B1.2060903@redhat.com> (raw)
In-Reply-To: <CAOiN93kV079jkdzY-R7jMVGQq4nN4c-sdswCq-XRaOpZm=ttwA@mail.gmail.com>

On 10/30/12 7:57 AM, Ashish Sangwan wrote:
> We have a 2TB HDD having native 4k sector size but emulated as 512bytes.
> And we want to use this device with sector size 4k and not 512bytes.
> 
> In mkfs.xfs there is option "-s", using which, one can set the sector size.
> What is the use case of this option?

That's a question for the xfs list ;)  xfs does issue IOs down
to that sector size, defaulting to 512, so setting it to the physical
sector size makes sense.  Newer mkfs.xfs does this automatically:

287d168b550857ce40e04b5f618d7eb91b87022f mkfs.xfs: properly handle physical sector size

    This primarily allows us to default to using the physical
    sectorsize for mkfs's "sector size" value, the fundamental
    size of any IOs the filesystem will perform.

> Also, such option is not present for ext4. So, apart from aligining the
>  partition on multiple of 8 sector numbers do we have to do something else
>  for using 4k sectors?

Nope.  Although I wouldn't specify a block size less than the physical
sector size (and if you do, mkfs.ext4 will complain) -

# blockdev --getss --getpbsz /dev/sde
512
4096
# mkfs.ext4 -b 1024 /dev/sde
mke2fs 1.41.12 (17-May-2010)
Warning: specified blocksize 1024 is less than device physical sectorsize 4096
...

> We measured the write performance of XFS/EXT4 with sector size 512bytes and 4KB.
> 
> XFS With 512 byte sector size=>
>  RecSize    WriteSpeed  RanReadSpeed RanWriteSpeed
>   524288   22.12MB/sec    0.00MB/sec    0.00MB/sec
>   262144   18.87MB/sec    0.00MB/sec    0.00MB/sec
>   131072   18.25MB/sec    0.00MB/sec    0.00MB/sec
>    65536   18.90MB/sec    0.00MB/sec    0.00MB/sec
>    32768   23.26MB/sec    0.00MB/sec    0.00MB/sec
>    16384   18.21MB/sec    0.00MB/sec    0.00MB/sec
>     8192   21.23MB/sec    0.00MB/sec    0.00MB/sec
>     4096   20.58MB/sec    0.00MB/sec    0.00MB/sec
> 
> XFS after setting 4KB sector size (-s size 4096) =>
> RecSize    WriteSpeed  RanReadSpeed RanWriteSpeed
>   524288   21.93MB/sec    0.00MB/sec    0.00MB/sec
>   262144   28.49MB/sec    0.00MB/sec    0.00MB/sec
>   131072   25.64MB/sec    0.00MB/sec    0.00MB/sec
>    65536   24.27MB/sec    0.00MB/sec    0.00MB/sec
>    32768   26.39MB/sec    0.00MB/sec    0.00MB/sec
>    16384   28.49MB/sec    0.00MB/sec    0.00MB/sec
>     8192   22.83MB/sec    0.00MB/sec    0.00MB/sec
>     4096   24.88MB/sec    0.00MB/sec    0.00MB/sec
> 
> Ext4 with default mkfs.ext4 options =>
>  RecSize    WriteSpeed  RanReadSpeed RanWriteSpeed
>   524288   31.95MB/sec    0.00MB/sec    0.00MB/sec
>   262144   26.88MB/sec    0.00MB/sec    0.00MB/sec
>   131072   23.04MB/sec    0.00MB/sec    0.00MB/sec
>    65536   25.91MB/sec    0.00MB/sec    0.00MB/sec
>    32768   24.69MB/sec    0.00MB/sec    0.00MB/sec
>    16384   24.27MB/sec    0.00MB/sec    0.00MB/sec
>     8192   32.05MB/sec    0.00MB/sec    0.00MB/sec
>     4096   30.21MB/sec    0.00MB/sec    0.00MB/sec
> 
> Ext4 performed little better than XFS (-s size 4096).
> Seeing this, we are tempted to believe that ext4 is already
> using 4k sectors.
> 
> Is there any way to make sure that ext4 is indeed using 4k sectors?

ext4 will only do IOs in multiples of block size, so if you set it to
4k, and properly align the filesystem start to a 4k boundary, there
is nothing else to do.

-Eric


      parent reply	other threads:[~2012-10-30 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 12:57 How to use new "native 4k sector sized" HDD with ext4 Ashish Sangwan
2012-10-30 14:22 ` Theodore Ts'o
2012-10-30 14:36   ` Eric Sandeen
2012-10-31  0:43   ` Dave Chinner
2012-10-31  5:32     ` Ashish Sangwan
2012-10-30 14:31 ` Eric Sandeen [this message]

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=508FE4B1.2060903@redhat.com \
    --to=sandeen@redhat.com \
    --cc=adilger@dilger.ca \
    --cc=ashishsangwan2@gmail.com \
    --cc=linkinjeon@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).