All of lore.kernel.org
 help / color / mirror / Atom feed
From: tytso@mit.edu
To: Brice Goglin <brice.goglin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Why is SECTOR_SIZE = 512 inside kernel ?
Date: Tue, 18 Aug 2015 21:38:04 +0000	[thread overview]
Message-ID: <20150818213804.GB8806@thunk.org> (raw)
In-Reply-To: <55D39E67.3010009@gmail.com>

On Tue, Aug 18, 2015 at 11:06:47PM +0200, Brice Goglin wrote:
> Le 17/08/2015 15:54, Theodore Ts'o a écrit :
> > 
> > It's cast in stone.  There are too many places all over the kernel,
> > especially in a huge number of file systems, which assume that the
> > sector size is 512 bytes.  So above the block layer, the sector size
> > is always going to be 512.
> 
> Could this be a problem when using pmem/nvdimm devices with
> byte-granularity (no BTT layer)? (hw_sector_size reports
> 512 in this case while we could expect 1 instead).
> Or it just doesn't matter because BTT is the only way to use
> these devices for filesystems like other block devices?

Right now there are very few applications that understand how to use
pmem/nvdimm devices as memory.  And even where they do, they will need
some kind of file system to provide resource isolation in case more
than one application or more than one user wants to use the
pmem/nvdimm.  In that case, they will probably mmap a file and then
access the nvdimm directly.  In that case, the applications won't be
using the block device layer at all, so they won't care about the
advertised hw_sector_Size.

The challenge with pmem-aware applications is that they need to be
able to correctly update their in-memory data structures in such a way
that they can correctly recover after an arbitrary power failure.
That means they have to use atomic updates and/or copy-on-write update
schemes, and I suspect most application writes just aren't going to be
able to get this right.

So for many legacy applications, they will still read in the file
"foo", make changes in local memory, and then write the new contents
to the file "foo.new", and then rename "foo.new" on top of "foo".
These applications will effectively use nvdimm as super fast flash,
and so they will use file systems as file systems.  And since file
systems today all use block sizes which are multiples of the
traditional 512 byte sector size, again, changing something as
fundamental as the kernel's internal sector size doesn't have any real
value, at least not as far as pmem/nvdimm support is concerned.

       	         	  	       	   - Ted

  reply	other threads:[~2015-08-18 21:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 12:53 Why is SECTOR_SIZE = 512 inside kernel ? Navin P
2015-08-17 13:54 ` Theodore Ts'o
2015-08-18 21:06   ` Brice Goglin
2015-08-18 21:38     ` tytso [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-17 11:05 Navin P
     [not found] ` <14960.1439831792@turing-police.cc.vt.edu>
2015-08-17 18:03   ` Navin P

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=20150818213804.GB8806@thunk.org \
    --to=tytso@mit.edu \
    --cc=brice.goglin@gmail.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.