From: Hannes Reinecke <hare@suse.de>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Jens Axboe <axboe@fb.com>, Alexander Graf <agraf@suse.com>,
Christoph Hellwig <hch@lst.de>, Ming Lei <tom.leiming@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] loop: Enable correct physical blocksize
Date: Tue, 1 Dec 2015 10:32:01 +0100 [thread overview]
Message-ID: <565D6911.4010206@suse.de> (raw)
In-Reply-To: <x49wptl4nya.fsf@segfault.boston.devel.redhat.com>
On 11/13/2015 09:57 PM, Jeff Moyer wrote:
> Hi Hannes,
>
> Hannes Reinecke <hare@suse.de> writes:
>
>> When running on files the physical blocksize is actually 4k,
>
> How did you come to that conclusion? Are you basing it on the file
> system block size? If so, that's configurable at mkfs time and can be
> anything from 512 bytes to 64k on current in-tree file systems that I
> know of (depending on platform, of course).
>
loop.c does this (in do_loop_switch()):
mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
lo->lo_backing_file = file;
lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ?
mapping->host->i_bdev->bd_block_size : PAGE_SIZE;
lo->old_gfp_mask = mapping_gfp_mask(mapping);
So either it's a block device, then we're taking the blocksize of
the underlying device, or we're using PAGE_SIZE.
Which is architecture dependent, of course.
> The main use for physical block size, as I understand it, is to allow
> partitioning utilities to place partitions on physical block boundaries
> of the underlying storage. The benefit of that is to avoid
> read-modify-writes for I/O which is naturally sized and aligned. If we
> carry that forward to loop, then I think it does makes sense to key off
> of the file system block size, but the fact remains that 4k is not
> universal.
>
The main point here is that some utilities (eg bootloaders) need to
know the _physical_ location of a particular blob, for which it
needs to know the physical blocksize.
> So, I think the idea is sound, but you should be setting the physical
> block size to sb->s_blocksize. And I don't see any reason why we
> wouldn't do this by default, do you?
>
Neither do I. But the code doesn't treat it that way, so I elected
to stay with the current version.
> If you end up reposting this patch, would you mind including more of
> this rationale in your commit message?
>
Sure.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2015-12-01 9:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-10 8:13 [PATCHv3 0/4] loop: enable different physical blocksizes Hannes Reinecke
2015-11-10 8:13 ` [PATCH 1/4] loop: Enable correct physical blocksize Hannes Reinecke
2015-11-13 20:57 ` Jeff Moyer
2015-12-01 9:32 ` Hannes Reinecke [this message]
2015-11-20 3:12 ` Ming Lei
2015-11-10 8:13 ` [PATCH 2/4] loop: Remove unused 'bdev' argument from loop_set_capacity Hannes Reinecke
2015-11-13 20:59 ` Jeff Moyer
2015-11-10 8:13 ` [PATCH 3/4] loop: Add 'lo_logical_blocksize' Hannes Reinecke
2015-11-10 8:13 ` [PATCH 4/4] loop: Pass logical blocksize in 'lo_init[0]' ioctl field Hannes Reinecke
2015-11-13 21:42 ` Jeff Moyer
-- strict thread matches above, loose matches on Subject: below --
2015-07-17 7:27 [PATCH 0/4] loop: enable different physical blocksizes Hannes Reinecke
2015-07-17 7:27 ` [PATCH 1/4] loop: Enable correct physical blocksize Hannes Reinecke
2015-07-27 5:15 ` Christoph Hellwig
2015-07-27 5:59 ` Hannes Reinecke
2015-08-07 7:31 ` Christoph Hellwig
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=565D6911.4010206@suse.de \
--to=hare@suse.de \
--cc=agraf@suse.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.leiming@gmail.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