linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Matthew Wilcox <willy@infradead.org>
Cc: Carlos Maiolino <cmaiolino@redhat.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	darrick.wong@oracle.com
Subject: Re: Extending FIEMAP ioctl to report device id
Date: Mon, 11 Feb 2019 13:52:25 -0700	[thread overview]
Message-ID: <E9F008F7-20B8-4E54-BCFC-B0019569AB4A@dilger.ca> (raw)
In-Reply-To: <20190211152345.GC12668@bombadil.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]

On Feb 11, 2019, at 8:23 AM, Matthew Wilcox <willy@infradead.org> wrote:
> 
> On Mon, Feb 11, 2019 at 10:43:06AM +0100, Carlos Maiolino wrote:
>> - The general idea, is to provide a way for FIEMAP ioctls to return the device
>>  id where each extent is physically located.
> 
> How does userspace get to use this information?  If I call fiemap() and
> it tells me extent 1 is on device 0x12345678 and extent 2 is on device
> 0x34567812, what can I do with that information?

For filesystems that may store a file on different devices, filefrag will
print out which device the file is located on, so that users can see where
the file is located.

Programs (e.g a mythical LILO that used FIEMAP instead of FIBMAP) could
check fe_device to see whether the whole file is located on the same block
device or not, and not allow booting from such a file.

> Bear in mind that glibc uses a different dev_t from the kernel.

That is glibc's problem.  The kernel would return fe_device using the same
dev_t that it uses for stat.st_dev and friends.  Even so, the majority of
users will care about "these blocks/files are on a different device than
those other blocks/files" and not the exact meaning of the bits.

>> - This is particularly useful for those filesystems where the file extents are
>>  located on a different block device other than that associated with the
>>  superblock , for example, btrfs using multiple devices, and XFS when using a
>>  real-time device.
> 
> Darrick said it was useful for _inside_ the kernel.  How is it useful
> for outside the kernel?

In my experience, this can be very useful for users to understand how their
file is allocated if there are performance or other issues with a particular
device.  Also, in some respects, it is _required_ for multi-device filesystems,
since it makes it clear that block 123 on one device is not related to the same
block number on a different device.

It may well be that ext4 will get some kind of multi-device capability in the
future (e.g. with the existing ext4 SMR patch using a separate flash journal
device and file data being permanently kept in the journal instead of the HDD,
or storing all the metadata on a flash device and all data on a HDD device).

Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

  reply	other threads:[~2019-02-11 20:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11  9:43 Extending FIEMAP ioctl to report device id Carlos Maiolino
2019-02-11 11:29 ` Nikolay Borisov
2019-02-11 14:56   ` Carlos Maiolino
2019-02-11 15:23 ` Matthew Wilcox
2019-02-11 20:52   ` Andreas Dilger [this message]
2019-02-11 21:34     ` Dave Chinner

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=E9F008F7-20B8-4E54-BCFC-B0019569AB4A@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=cmaiolino@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=willy@infradead.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).