Skip to contentSkip to conversation

master - device: if BLKPBSZGET is unavailable, enforce 512

PATCH Zdenek Kabelac 1 participant 1 message Dec 18, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3c818c89467f9b54bc94d9919a127dd912d96c24
Commit:        3c818c89467f9b54bc94d9919a127dd912d96c24
Parent:        434d95cef31c4d95b6468e02397e1fedbdca9928
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Dec 18 10:52:09 2013 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Dec 18 10:52:09 2013 +0100

device: if BLKPBSZGET is unavailable, enforce 512

If there is no define for BLKPBSZGET - we have hard time how to decrypt physical block size - we can't use here block_size, since this is usually 4k while we need to use 512b.

FIXME: find some better way, until that enforce value 512. Eventually we could also try to put in:

+#ifndef BLKPBSZGET
+# define BLKPBSZGET _IO(0x12,123)
+#endif

but this will still not work well on old kernels.

---
 lib/device/dev-io.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
lib/device/dev-io.c +2 -1
index 766d9af..1bfac1d 100644
@@ -157,7 +157,8 @@ int dev_get_block_size(struct device *dev, unsigned int *physical_block_size, un
 	}
 #else
 	/* if we can't get physical block size, just use logical block size instead */
-	dev->phys_block_size = dev->block_size;
+	// FIXME block_size is typically 4096b while phys_block_size is 512b
+	dev->phys_block_size = 512;// dev->block_size;
 	log_debug_devs("%s: physical block size can't be determined, using logical "
 		       "block size of %u bytes instead", name, dev->phys_block_size);
 #endif