From: Omar Sandoval <osandov@osandov.com>
To: Karel Zak <kzak@redhat.com>
Cc: linux-block@vger.kernel.org, kernel-team@fb.com,
Hannes Reinecke <hare@suse.de>, Ming Lei <ming.lei@redhat.com>,
Milan Broz <gmazyland@gmail.com>
Subject: Re: [PATCH v3 3/4] loop: use queue limit instead of private lo_logical_blocksize
Date: Wed, 23 Aug 2017 09:16:44 -0700 [thread overview]
Message-ID: <20170823161644.GA15578@vader> (raw)
In-Reply-To: <20170823092355.uvydhxvo4bf6zohr@ws.net.home>
On Wed, Aug 23, 2017 at 11:23:55AM +0200, Karel Zak wrote:
> On Tue, Aug 22, 2017 at 10:33:00AM -0700, Omar Sandoval wrote:
> > @@ -946,6 +938,9 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
> >
> > if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
> > blk_queue_write_cache(lo->lo_queue, true, false);
> > + blk_queue_logical_block_size(lo->lo_queue, 512);
> > + blk_queue_physical_block_size(lo->lo_queue, 512);
> > + blk_queue_io_min(lo->lo_queue, 512);
>
> ...
>
> > @@ -1133,14 +1128,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
> ...
> > + if (info->lo_flags & LO_FLAGS_BLOCKSIZE) {
> > + blk_queue_logical_block_size(lo->lo_queue, LO_INFO_BLOCKSIZE(info));
> > + blk_queue_physical_block_size(lo->lo_queue, LO_INFO_BLOCKSIZE(info));
> > + blk_queue_io_min(lo->lo_queue, LO_INFO_BLOCKSIZE(info));
> > + }
> > +
>
> I don't understand this.
>
> * it seems the default is 512, but what about if the backing file
> is not a regular file? For example "losetup -f /dev/sda" where
> sda sector size is > 512.
I didn't change the legacy behavior here, i.e., it's always 512 by
default.
> * why the attributes in the /sys are affected by LO_FLAGS_BLOCKSIZE?
> Would be better to have a real sizes there (independently on the flag)?
What do you mean? LO_FLAGS_BLOCKSIZE means I want to change the logical
blocksize of the loop device, so why shouldn't it be reflected in sysfs?
> * I think kernel lies in /sys about I/O size now. The phy sector size
> has never been 512, but PAGE_SIZE or real phy sector if backing file
> is a block device.
>
> Your patch improves it for LO_FLAGS_BLOCKSIZE, but it's still lies
> about internally used I/O sizes.
>
> Why we cannot use
>
> blk_queue_physical_block_size(lo->lo_queue, lo->lo_blocksize);
> blk_queue_logical_block_size(lo->lo_queue, lo->lo_logical_blocksize);
>
> (as suggested by Hannes' original patch), but without
>
> if (info->lo_flags & LO_FLAGS_BLOCKSIZE)
>
> condition?
>
> Yes, result will be backwardly incompatible, but the current
> situation (all is 512) does not describe reality. It's legacy from
> time where all in kernel was 512...
I went back and forth on this. Yeah, the kernel is lying, and using the
backing block size makes more sense, but backwards compatability is
exactly why I didn't change this. Then again, the physical block size is
more of a hint, so it might be safe to change this.
next prev parent reply other threads:[~2017-08-23 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 17:32 [PATCH v3 0/4] loop: LO_FLAGS_BLOCKSIZE fixes Omar Sandoval
2017-08-22 17:32 ` [PATCH v3 1/4] loop: fix hang if LOOP_SET_STATUS gets invalid blocksize or encrypt type Omar Sandoval
2017-08-22 17:32 ` [PATCH v3 2/4] loop: set discard and write zeroes limits in 512 byte sectors Omar Sandoval
2017-08-23 6:19 ` Hannes Reinecke
2017-08-22 17:33 ` [PATCH v3 3/4] loop: use queue limit instead of private lo_logical_blocksize Omar Sandoval
2017-08-23 9:23 ` Karel Zak
2017-08-23 16:16 ` Omar Sandoval [this message]
2017-08-22 17:33 ` [PATCH v3 4/4] loop: always return block size in LOOP_GET_STATUS Omar Sandoval
2017-08-22 20:25 ` [PATCH v3 0/4] loop: LO_FLAGS_BLOCKSIZE fixes Jens Axboe
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=20170823161644.GA15578@vader \
--to=osandov@osandov.com \
--cc=gmazyland@gmail.com \
--cc=hare@suse.de \
--cc=kernel-team@fb.com \
--cc=kzak@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.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 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.