Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
lvm2.1005
device-if-BLKPBSZGET-is-unavailable-try-to-use-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File device-if-BLKPBSZGET-is-unavailable-try-to-use-BLKSS.patch of Package lvm2.1005
From 3fbf50379b5d29aab1a560d98cd0e23449bc91c6 Mon Sep 17 00:00:00 2001 From: Liuhua Wang <lwang@suse.com> Date: Mon, 2 Nov 2015 14:04:52 +0800 Subject: [PATCH] device: if BLKPBSZGET is unavailable, try to use BLKSSZGET with fallback to 512b Upstream-commit: f270bbd442b3c36115ea490ec838cf29277a46d2 --- lib/device/dev-io.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index d15f7a8..5cc5a61 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -156,13 +156,24 @@ int dev_get_block_size(struct device *dev, unsigned int *physical_block_size, un } log_debug("%s: physical block size is %u bytes", name, dev->phys_block_size); } -#else +#elif BLKSSZGET /* if we can't get physical block size, just use logical block size instead */ - // FIXME block_size is typically 4096b while phys_block_size is 512b - dev->phys_block_size = 512;// dev->block_size; - - log_debug("%s: physical block size can't be determined, using logical " - "block size of %u bytes instead", name, dev->phys_block_size); + if (dev->phys_block_size == -1) { + if (ioctl(dev_fd(dev), BLKSSZGET, &dev->phys_block_size) < 0) { + log_sys_error("ioctl BLKSSZGET", name); + r = 0; + goto out; + } + log_debug("%s: physical block size can't be determined, using logical " + "block size of %u bytes", name, dev->phys_block_size); + } +#else + /* if even BLKSSZGET is not available, use default 512b */ + if (dev->phys_block_size == -1) { + dev->phys_block_size = 512; + log_debug("%s: physical block size can't be determined, using block " + "size of %u bytes instead", name, dev->phys_block_size); + } #endif *physical_block_size = (unsigned int) dev->phys_block_size; -- 1.8.4.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor