All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] blockdev: Remove the --setbsz (set blocksize) option which has never worked.
Date: Tue, 8 Oct 2013 15:09:40 +0100	[thread overview]
Message-ID: <20131008140940.GW1887@redhat.com> (raw)
In-Reply-To: <5254113A.2010709@draigBrady.com>

On Tue, Oct 08, 2013 at 03:05:46PM +0100, Pádraig Brady wrote:
> On 10/08/2013 09:54 AM, Richard W.M. Jones wrote:
> > From: "Richard W.M. Jones" <rjones@redhat.com>
> > 
> > This option has never worked.  If you try setting the block size on a
> > block device, and then read it using --getbsz, you will see that the
> > block size never changes.
> > 
> > The reason for this is because the block size is specific to the
> > current file descriptor opening the block device, so the change of
> > block size only persists for as long as blockdev has the device open,
> > and is lost once blockdev exits.
> > 
> > Also the block size is not really used anywhere.  Filesystems, for
> > example, have their own idea of block size and ignore this setting
> > completely.
> > 
> > (Thanks Masayoshi Mizuma for diagnosing the problem)
> > 
> > Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> > ---
> >  bash-completion/blockdev | 7 +------
> >  disk-utils/blockdev.8    | 2 --
> >  disk-utils/blockdev.c    | 7 -------
> >  3 files changed, 1 insertion(+), 15 deletions(-)
> > 
> > diff --git a/bash-completion/blockdev b/bash-completion/blockdev
> > index ce986cb..5889955 100644
> > --- a/bash-completion/blockdev
> > +++ b/bash-completion/blockdev
> > @@ -19,7 +19,6 @@ _blockdev_module()
> >  		--getalignoff
> >  		--getmaxsect
> >  		--getbsz
> > -		--setbsz
> >  		--getsize64
> >  		--setra
> >  		--getra
> > @@ -29,11 +28,7 @@ _blockdev_module()
> >  		--rereadpt
> >  		$DEVS"
> >  	case $prev in
> > -		'--setbsz')
> > -			COMPREPLY=( $(compgen -W "bytes" -- $cur) )
> > -			return 0
> > -			;;
> > -		'--setbsz'|'--setfra')
> > +		'--setfra')
> >  			COMPREPLY=( $(compgen -W "sectors" -- $cur) )
> >  			return 0
> >  			;;
> > diff --git a/disk-utils/blockdev.8 b/disk-utils/blockdev.8
> > index 2b3d64c..6ab4324 100644
> > --- a/disk-utils/blockdev.8
> > +++ b/disk-utils/blockdev.8
> > @@ -67,8 +67,6 @@ Print sectorsize in bytes - usually 512.
> >  Get size in 512-byte sectors.
> >  .IP "\fB\-\-rereadpt\fP"
> >  Reread partition table
> > -.IP "\fB\-\-setbsz\fP \fIbytes\fP"
> > -Set blocksize.
> >  .IP "\fB\-\-setfra\fP \fIsectors\fP"
> >  Set filesystem readahead (same like --setra on 2.6 kernels).
> >  .IP "\fB\-\-setra\fP \fIsectors\fP"
> > diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c
> > index 4543818..dc02d48 100644
> > --- a/disk-utils/blockdev.c
> > +++ b/disk-utils/blockdev.c
> > @@ -122,13 +122,6 @@ static const struct bdc bdcms[] =
> >  		.argval = -1,
> >  		.help = N_("get blocksize")
> >  	},{
> > -		IOCTL_ENTRY(BLKBSZSET),
> > -		.name = "--setbsz",
> > -		.argname = "<bytes>",
> > -		.argtype = ARG_INT,
> > -		.flags = FL_NORESULT,
> > -	        .help = N_("set blocksize")
> > -	},{
> >  		IOCTL_ENTRY(BLKGETSIZE),
> >  		.name = "--getsize",
> >  		.argtype = ARG_ULONG,
> > 
> 
> Might one process the adjusted block device in a subshell?
> 
> $ (blockdev --setbsz 2048 /dev/stdin; blockdev --getbsz /dev/stdin) < /dev/loop0
> 2048

Yes .. if that was documented anywhere, if it wasn't so obscure, and
if it was useful for anything except changing a handle property that
nothing uses.

There's an informative but unfortunately private exchange on the
subject in this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1002825

I have asked if we can make the contents of this bug public.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

  reply	other threads:[~2013-10-08 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08  8:54 [PATCH] blockdev: Remove the --setbsz (set blocksize) option which has never worked Richard W.M. Jones
2013-10-08 13:56 ` Karel Zak
2013-10-08 14:05 ` Pádraig Brady
2013-10-08 14:09   ` Richard W.M. Jones [this message]
2013-10-08 15:56     ` Pádraig Brady
2013-10-09  9:31       ` Karel Zak
2013-10-11  9:18       ` Karel Zak
2013-10-09 10:52     ` Richard W.M. Jones

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=20131008140940.GW1887@redhat.com \
    --to=rjones@redhat.com \
    --cc=P@draigBrady.com \
    --cc=util-linux@vger.kernel.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 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.