]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme: set block size to blkdev before re-read partition
authorMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 7 Jan 2021 07:28:44 +0000 (16:28 +0900)
committerKeith Busch <kbusch@kernel.org>
Tue, 12 Jan 2021 22:13:18 +0000 (15:13 -0700)
commit8cbbd231ff19b3b1b1dab797374d6c1f8bcefff8
tree772d56f87dc64581780d5744500efcfe990ad99c
parentcd21ddedc6a73f16cb89ec937892a508944527d7
nvme: set block size to blkdev before re-read partition

Before re-reading partition information from a block device, to make
block size of the block device, application should do either:

- Close current file descriptor and re-open it again.
- Request block device to set block size by itself.

Kernel community has discussions about it, and can be found at [1].

The first option might not be good for readability in this program which
is one-shot command-based application.  All the subcommands are
constructed "fd open -> issue command -> fd close".  I don't want to
break the common style for this requirement.

This patch takes the second one and it just ioctl() to the block device
to update it's block size to a given value.

[1] https://lore.kernel.org/linux-nvme/20210105150214.GA16251@lst.de/T/#u

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
nvme.c