From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>,
Alexander Graf <agraf@suse.com>, Ming Lei <tom.leiming@gmail.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linux-kernel@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH 2/2] loop: support 4k physical blocksize
Date: Thu, 3 Nov 2016 15:26:44 +0100 [thread overview]
Message-ID: <20161103142644.GA15480@lst.de> (raw)
In-Reply-To: <1478181846-88863-3-git-send-email-hare@suse.de>
> -figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
> +figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit,
> + loff_t logical_blocksize)
> {
> loff_t size = get_size(offset, sizelimit, lo->lo_backing_file);
> sector_t x = (sector_t)size;
> @@ -233,6 +234,12 @@ figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
> lo->lo_offset = offset;
> if (lo->lo_sizelimit != sizelimit)
> lo->lo_sizelimit = sizelimit;
> + if (lo->lo_flags & LO_FLAGS_BLOCKSIZE) {
> + lo->lo_logical_blocksize = logical_blocksize;
> + blk_queue_physical_block_size(lo->lo_queue, lo->lo_blocksize);
> + blk_queue_logical_block_size(lo->lo_queue,
> + lo->lo_logical_blocksize);
> + }
I've looked how the existing code uses lo_blocksize and this whole thing
confuses me to no end. Can we have all the blocksize assignments (i.e.
including the existing lo_blocksize assignments) in one single place and
documented? Especialy as it seems so far lo_blocksize seems to be
the "fs" blocksize as set by set_blocksize, which seems totally wrong
to be set by loop at all.
> + if (info->lo_flags & LO_FLAGS_BLOCKSIZE) {
> + lo->lo_flags |= LO_FLAGS_BLOCKSIZE;
> + if ((info->lo_init[0] != 512) &&
> + (info->lo_init[0] != 1024) &&
> + (info->lo_init[0] != 2048) &&
> + (info->lo_init[0] != 4096))
> + return -EINVAL;
No need for the inner braces. Also please find a way to have a
descriptive name for the field, be that an anonymous union, or a #define.
> + (lo->lo_logical_blocksize != info->lo_init[0])))
Same comment about the inner braces here.
> + if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
> + info->lo_init[0]))
> return -EFBIG;
>
> loop_config_discard(lo);
> @@ -1303,7 +1328,8 @@ static int loop_set_capacity(struct loop_device *lo)
> if (unlikely(lo->lo_state != Lo_bound))
> return -ENXIO;
>
> - return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit);
> + return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit,
> + lo->lo_logical_blocksize);
I'd say drop all the arguments but lo here (maybe in a prep patch) as
passing them all seems pointless and confusing.
next prev parent reply other threads:[~2016-11-03 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 14:04 [PATCHv4 0/2] loop: enable different logical blocksizes Hannes Reinecke
2016-11-03 14:04 ` [PATCHv3 1/2] loop: Remove unused 'bdev' argument from loop_set_capacity Hannes Reinecke
2016-11-03 14:04 ` [PATCH 2/2] loop: support 4k physical blocksize Hannes Reinecke
2016-11-03 14:26 ` Christoph Hellwig [this message]
2016-11-03 15:40 ` Ming Lei
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=20161103142644.GA15480@lst.de \
--to=hch@lst.de \
--cc=agraf@suse.com \
--cc=axboe@fb.com \
--cc=hare@suse.com \
--cc=hare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--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
Powered by JetHome