public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Jan Tulak <jtulak@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices
Date: Fri, 8 Apr 2016 10:50:54 -0500	[thread overview]
Message-ID: <5707D35E.7070703@sandeen.net> (raw)
In-Reply-To: <CACj3i73JEzCj-4kp3=H9mjXCKYgcOUYCOyq-aZSWZFXUih+0MA@mail.gmail.com>

On 4/8/16 9:58 AM, Jan Tulak wrote:
>     Ok, platform_findsizes already explicitly handled regular files, and tries to
>     find out via an xfs ioctl what the minimum DIO size is, and uses that for
>     the sector size for the filesystem in the iamge. 
> 
> 
>     Now you stat & get the blocksize, and use that instead, but it's likely
>     to be different:
> 
>     i.e. before:
> 
>     # mkfs/mkfs.xfs -f fsfile
>     meta-data=fsfile                 isize=512    agcount=4, agsize=65536 blks
>              =                       sectsz=512   attr=2, projid32bit=1
> 
>     after:
> 
>     # mkfs/mkfs.xfs -f fsfile
>     meta-data=fsfile                 isize=512    agcount=4, agsize=65536 blks
>              =                       sectsz=4096  attr=2, projid32bit=1
> 
>     and also, now:
> 
>     # mkfs/mkfs.xfs -f -dfile,name=fsfile,size=1g -b size=2048
>     block size 2048 cannot be smaller than logical sector size 4096
> 
>     What prompted you to make this change, was there some other problem you
>     needed to fix?
> 
> 
> ​But DIO is disabled for the files, per the commit message:
> [...] and turning off
> direct IO. Then ensure that we check the "isfile" options before
> doing things that are specific to block devices.  Also, as direct IO
> is disabled for files, use statfs() for getting host FS blocksize,
> not platform_findsizes().​

But doing DIO to the file during mkfs isn't the issue I'm talking about;
For example a vm image hosted in a file will have direct IO done to it
when it is in use, and filesystem block size is not the controlling
factor there.

With your change, we can no longer make i.e. a 2k fs image hosted on a 4k
fs.  i.e. your change regresses this commit:

commit 98dd72d3b239050138cf9eb9373c83743878a7d2
Author: Eric Sandeen <sandeen@sandeen.net>
Date:   Fri Dec 18 12:15:25 2015 +1100

    mkfs: get sector size from host fs d_miniosz when mkfs'ing file
    
    Now that we allow logical-sector-sized DIOs even if our xfs
    filesystem is set to physical-sector-sized "sectors," we can
    allow the creation of filesystem images with block and sector
    sizes down to the host device's logical sector size, rather
    than the filesystem's sector size.
    
    So in platform_findsizes(), change our query of the filesystem
    to an XFS_IOC_DIOINFO query, and use the returned d_miniosz for
    sector size in the S_IFREG case.
    
    This allows the creation of i.e. a 2k block sized image on
    an xfs filesystem w/ 4k sector size created on a 4k/512
    block device, which would otherwise fail today.
    
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Signed-off-by: Dave Chinner <david@fromorbit.com>


> So we have to use whatever the underlying fs tells us, not what the physical device has, right?

Well, tells us about what?  XFS can tell us its block size, but also can
tell us about minimum size and alignment required for direct IO, which is
more relevant to a filesystem image than the filesystem's block size.

> ​ Rather, I wonder if there is any reason to keep the
> platform_findsizes part about regular files - it shouldn't get into
> the branch ever.

In general, having a wrapper which finds sizes of a target, regardless of
platform, device, or file, makes sense to me rather than having stat calls
in various other places...

-Eric

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2016-04-08 15:50 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 11:15 [PATCH 00/19] mkfs cleaning jtulak
2016-03-24 11:15 ` [PATCH 01/19] xfsprogs: use common code for multi-disk detection jtulak
2016-03-31 20:25   ` Eric Sandeen
2016-04-06  9:05     ` Jan Tulak
2016-03-24 11:15 ` [PATCH 02/19] mkfs: sanitise ftype parameter values jtulak
2016-03-24 16:33   ` Eric Sandeen
2016-03-29 16:11     ` Jan Tulak
2016-03-29 16:17       ` Eric Sandeen
2016-03-29 16:20         ` Jan Tulak
2016-03-29 17:14         ` Jan Tulak
2016-03-24 11:15 ` [PATCH 03/19] mkfs: Sanitise the superblock feature macros jtulak
2016-04-01  2:05   ` Eric Sandeen
2016-04-06  9:12     ` Jan Tulak
2016-04-06 21:01       ` Dave Chinner
2016-04-07 11:53         ` Jan Tulak
2016-04-07  0:12   ` Eric Sandeen
2016-04-07  1:43   ` Eric Sandeen
2016-04-07 13:09     ` Jan Tulak
2016-04-07 13:18       ` Eric Sandeen
2016-04-07 13:27         ` Jan Tulak
2016-03-24 11:15 ` [PATCH 04/19] mkfs: validate all input values jtulak
2016-04-06 23:02   ` Eric Sandeen
2016-04-07 11:15     ` Jan Tulak
2016-03-24 11:15 ` [PATCH 05/19] mkfs: factor boolean option parsing jtulak
2016-04-07  2:48   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 06/19] mkfs: validate logarithmic parameters sanely jtulak
2016-04-07  2:52   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 07/19] mkfs: structify input parameter passing jtulak
2016-04-07  3:14   ` Eric Sandeen
2016-04-07 11:43     ` Jan Tulak
2016-03-24 11:15 ` [PATCH 08/19] mkfs: getbool is redundant jtulak
2016-04-07 17:25   ` Eric Sandeen
2016-04-08 10:30     ` Jan Tulak
2016-04-08 17:41       ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 09/19] mkfs: use getnum_checked for all ranged parameters jtulak
2016-04-07 19:02   ` Eric Sandeen
2016-04-08 10:47     ` Jan Tulak
2016-04-08 15:52       ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 10/19] mkfs: add respecification detection to generic parsing jtulak
2016-04-07 19:06   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 11/19] mkfs: table based parsing for converted parameters jtulak
2016-04-07 19:08   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 12/19] mkfs: merge getnum jtulak
2016-04-07 19:14   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 13/19] mkfs: encode conflicts into parsing table jtulak
2016-04-07 22:40   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 14/19] mkfs: add string options to generic parsing jtulak
2016-04-07 22:49   ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 15/19] mkfs: don't treat files as though they are block devices jtulak
2016-04-08  0:25   ` Eric Sandeen
2016-04-08  0:32     ` Eric Sandeen
2016-04-08 14:58     ` Jan Tulak
2016-04-08 15:50       ` Eric Sandeen [this message]
2016-04-08 15:56         ` Jan Tulak
2016-04-09  4:12       ` Eric Sandeen
2016-04-13 15:43         ` Jan Tulak
2016-04-14  9:49       ` Jan Tulak
2016-04-20  9:51         ` Jan Tulak
2016-04-20 13:17           ` Jan Tulak
2016-04-20 16:53             ` Eric Sandeen
2016-04-21  9:22               ` Jan Tulak
2016-03-24 11:15 ` [PATCH 16/19] mkfs: move spinodes crc check jtulak
2016-03-24 11:15 ` [PATCH 17/19] xfsprogs: disable truncating of files jtulak
2016-04-06 21:42   ` Eric Sandeen
2016-04-07  9:41     ` Jan Tulak
2016-04-08  0:09   ` Dave Chinner
2016-04-08 10:06     ` Jan Tulak
2016-04-08 23:08       ` Dave Chinner
2016-04-13 15:08         ` Jan Tulak
2016-04-13 16:17           ` Eric Sandeen
2016-04-13 16:23             ` Jan Tulak
2016-04-13 16:25               ` Eric Sandeen
2016-04-13 21:37             ` Dave Chinner
2016-04-14 12:31               ` Jan Tulak
2016-03-24 11:15 ` [PATCH 18/19] mkfs: unit conversions are case insensitive jtulak
2016-04-06 21:10   ` Eric Sandeen
2016-04-07 10:50     ` Jan Tulak
2016-04-08  0:41       ` Eric Sandeen
2016-04-08  1:03         ` Dave Chinner
2016-04-08  9:08           ` Jan Tulak
2016-04-08 15:51             ` Eric Sandeen
2016-03-24 11:15 ` [PATCH 19/19] mkfs: add optional 'reason' for illegal_option jtulak
2016-04-06 22:23   ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2016-04-21  9:39 [PATCH 00/19 v2] mkfs cleaning Jan Tulak
2016-04-21  9:39 ` [PATCH 15/19] mkfs: don't treat files as though they are block devices Jan Tulak
2016-04-21 12:43   ` Jan Tulak
2016-04-21 20:13     ` Eric Sandeen
2016-04-22  7:46       ` Jan Tulak
2016-05-02 23:13   ` Eric Sandeen

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=5707D35E.7070703@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=jtulak@redhat.com \
    --cc=xfs@oss.sgi.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