block: add logical_block_size property

Add a logical block size attribute as various guest side tools only
increase the filesystem sector size based on it, not the advisory
physical block size.

For scsi we already have support for a different logical block size
in place for CDROMs that we can built upon.  Only my recent block
device characteristics VPD page needs some fixups.  Note that we
leave the logial block size for CDROMs hardcoded as the 2k value
is expected for it in general.

For virtio-blk we already have a feature flag claiming to support
a variable logical block size that was added for the s390 kuli
hypervisor.  Interestingly it does not actually change the units
in which the protocol works, which is still fixed at 512 bytes,
but only communicates a different minimum I/O granularity.  So
all we need to do in virtio is to add a trap for unaligned I/O
and round down the device size to the next multiple of the logical
block size.

IDE does not support any other logical block size than 512 bytes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
4 files changed
tree: 4ef370b2b6c6946af66e9bcdfa013a1e93b5079c
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. gdb-xml/
  9. hw/
  10. linux-user/
  11. net/
  12. pc-bios/
  13. QMP/
  14. roms/
  15. slirp/
  16. sysconfigs/
  17. target-alpha/
  18. target-arm/
  19. target-cris/
  20. target-i386/
  21. target-m68k/
  22. target-microblaze/
  23. target-mips/
  24. target-ppc/
  25. target-s390x/
  26. target-sh4/
  27. target-sparc/
  28. tcg/
  29. tests/
  30. .gitignore
  31. .gitmodules
  32. a.out.h
  33. acl.c
  34. acl.h
  35. aes.c
  36. aes.h
  37. aio.c
  38. alpha-dis.c
  39. alpha.ld
  40. arm-dis.c
  41. arm-semi.c
  42. arm.ld
  43. async.c
  44. balloon.h
  45. block-migration.c
  46. block-migration.h
  47. block.c
  48. block.h
  49. block_int.h
  50. bswap.h
  51. bt-host.c
  52. bt-host.h
  53. bt-vhci.c
  54. buffered_file.c
  55. buffered_file.h
  56. cache-utils.c
  57. cache-utils.h
  58. Changelog
  59. check-qdict.c
  60. check-qfloat.c
  61. check-qint.c
  62. check-qjson.c
  63. check-qlist.c
  64. check-qstring.c
  65. cmd.c
  66. cmd.h
  67. cocoa.m
  68. CODING_STYLE
  69. config.h
  70. configure
  71. console.c
  72. console.h
  73. COPYING
  74. COPYING.LIB
  75. cpu-all.h
  76. cpu-common.h
  77. cpu-defs.h
  78. cpu-exec.c
  79. create_config
  80. cris-dis.c
  81. curses.c
  82. curses_keys.h
  83. cutils.c
  84. d3des.c
  85. d3des.h
  86. def-helper.h
  87. device_tree.c
  88. device_tree.h
  89. dis-asm.h
  90. disas.c
  91. disas.h
  92. dma-helpers.c
  93. dma.h
  94. dyngen-exec.h
  95. elf.h
  96. envlist.c
  97. envlist.h
  98. exec-all.h
  99. exec.c
  100. feature_to_c.sh
  101. gdbstub.c
  102. gdbstub.h
  103. gen-icount.h
  104. host-utils.c
  105. host-utils.h
  106. hpet.h
  107. hppa-dis.c
  108. hppa.ld
  109. hxtool
  110. i386-dis.c
  111. i386.ld
  112. ia64.ld
  113. input.c
  114. ioport-user.c
  115. ioport.c
  116. ioport.h
  117. json-lexer.c
  118. json-lexer.h
  119. json-parser.c
  120. json-parser.h
  121. json-streamer.c
  122. json-streamer.h
  123. keymaps.c
  124. keymaps.h
  125. kvm-all.c
  126. kvm.h
  127. libfdt_env.h
  128. LICENSE
  129. linux-aio.c
  130. m68k-dis.c
  131. m68k-semi.c
  132. m68k.ld
  133. MAINTAINERS
  134. Makefile
  135. Makefile.hw
  136. Makefile.objs
  137. Makefile.target
  138. Makefile.user
  139. microblaze-dis.c
  140. migration-exec.c
  141. migration-fd.c
  142. migration-tcp.c
  143. migration-unix.c
  144. migration.c
  145. migration.h
  146. mips-dis.c
  147. mips.ld
  148. module.c
  149. module.h
  150. monitor.c
  151. monitor.h
  152. nbd.c
  153. nbd.h
  154. net-checksum.c
  155. net.c
  156. net.h
  157. osdep.c
  158. osdep.h
  159. path.c
  160. pci-ids.txt
  161. posix-aio-compat.c
  162. ppc-dis.c
  163. ppc.ld
  164. ppc64.ld
  165. qbool.c
  166. qbool.h
  167. qdict-test-data.txt
  168. qdict.c
  169. qdict.h
  170. qemu-aio.h
  171. qemu-barrier.h
  172. qemu-binfmt-conf.sh
  173. qemu-char.c
  174. qemu-char.h
  175. qemu-common.h
  176. qemu-config.c
  177. qemu-config.h
  178. qemu-doc.texi
  179. qemu-error.c
  180. qemu-error.h
  181. qemu-img-cmds.hx
  182. qemu-img.c
  183. qemu-img.texi
  184. qemu-io.c
  185. qemu-lock.h
  186. qemu-log.h
  187. qemu-malloc.c
  188. qemu-monitor.hx
  189. qemu-nbd.c
  190. qemu-nbd.texi
  191. qemu-objects.h
  192. qemu-option.c
  193. qemu-option.h
  194. qemu-options.hx
  195. qemu-queue.h
  196. qemu-sockets.c
  197. qemu-tech.texi
  198. qemu-thread.c
  199. qemu-thread.h
  200. qemu-timer.h
  201. qemu-tool.c
  202. qemu-x509.h
  203. qemu.sasl
  204. qemu_socket.h
  205. qerror.c
  206. qerror.h
  207. qfloat.c
  208. qfloat.h
  209. qint.c
  210. qint.h
  211. qjson.c
  212. qjson.h
  213. qlist.c
  214. qlist.h
  215. qobject.h
  216. qstring.c
  217. qstring.h
  218. readline.c
  219. readline.h
  220. README
  221. rules.mak
  222. rwhandler.c
  223. rwhandler.h
  224. s390-dis.c
  225. s390.ld
  226. savevm.c
  227. sdl.c
  228. sdl_keysym.h
  229. sdl_zoom.c
  230. sdl_zoom.h
  231. sdl_zoom_template.h
  232. sh4-dis.c
  233. softmmu-semi.h
  234. softmmu_defs.h
  235. softmmu_exec.h
  236. softmmu_header.h
  237. softmmu_template.h
  238. sparc-dis.c
  239. sparc.ld
  240. sparc64.ld
  241. sysemu.h
  242. targphys.h
  243. tcg-runtime.c
  244. texi2pod.pl
  245. thunk.c
  246. thunk.h
  247. TODO
  248. translate-all.c
  249. uboot_image.h
  250. usb-bsd.c
  251. usb-linux.c
  252. usb-stub.c
  253. VERSION
  254. vgafont.h
  255. vl.c
  256. vnc-auth-sasl.c
  257. vnc-auth-sasl.h
  258. vnc-auth-vencrypt.c
  259. vnc-auth-vencrypt.h
  260. vnc-tls.c
  261. vnc-tls.h
  262. vnc.c
  263. vnc.h
  264. vnc_keysym.h
  265. vnchextile.h
  266. x86_64.ld
  267. x_keymap.c
  268. x_keymap.h