)]}'
{"nova/privsep/utils.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e29fd06897738e606ef0a648deb568a0f131b7cb","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_de96cba0","line":47,"updated":"2018-11-08 22:34:57.000000000","message":"As noted in the bug, is there any worth in checking 4096 and failing that falling back to check 512?","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"},{"author":{"_account_id":13252,"name":"Dr. Jens Harbott","display_name":"Jens Harbott (frickler)","email":"frickler@offenerstapel.de","username":"jrosenboom"},"change_message_id":"c6d794b336b0d0238c05dcec99da6054d01dd168","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_4f0f5c2b","line":47,"in_reply_to":"3f79a3b5_19753297","updated":"2018-11-09 15:18:24.000000000","message":"So I did a bit more testing: The check we are trying to perform is whether O_DIRECT is working or failing. In the latter case we see an EINVAL error.\n\nThere will also be an EINVAL error if the write size isn\u0027t a multiple of the sector size or if it isn\u0027t aligned on sector boundaries (this is probably why the variable has been called align_size). But this check doesn\u0027t need to find out anything about the effective sector size, that is the job of qemu or the OS within the VM lateron.\n\nSo for the purpose of this check, the most generic solution would be to use the least common multiple of all possible sector sizes. They usually seem to be powers of two and the maximum I\u0027ve seen mentioned was 65536, i.e. 2^16, so choosing that value would seem sensible.\n\nThere are mentions of some sector sizes that are not a power of two, but according to [1] those are likely to have been deprecated and I don\u0027t think we need to account for these.\n\n[1] https://wiki.illumos.org/display/illumos/ZFS+and+Advanced+Format+disks","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"},{"author":{"_account_id":13252,"name":"Dr. Jens Harbott","display_name":"Jens Harbott (frickler)","email":"frickler@offenerstapel.de","username":"jrosenboom"},"change_message_id":"487e76cc88c040b0fa39cf6e9fe00cb219d20065","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_f9506f2f","line":47,"in_reply_to":"3f79a3b5_3084bcb1","updated":"2018-11-09 20:55:39.000000000","message":"Intel e.g. lists these:\n\n\"The NVMe drives support 512, 520, 528, 4096, 4104, 4160, and 4224 bytes Variable Sector Size. \" [1]\n\nBut again I\u0027ve never seen anything but 512 or 4096 being used in practice. Though if we want to be completely on the safe side, we could use the \"ioctl(2) BLKSSZGET\" call mentioned in the man page above.\n\n[1] https://www.intel.com/content/www/us/en/support/articles/000016238/memory-and-storage/data-center-ssds.html","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"},{"author":{"_account_id":8768,"name":"Chris Friesen","email":"chris.friesen@windriver.com","username":"cbf123"},"change_message_id":"328dfdb2cc6a71e4d18489e15154b0885194b9f6","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_7006b4ce","line":47,"in_reply_to":"3f79a3b5_4f0f5c2b","updated":"2018-11-09 17:01:27.000000000","message":"Are you sure you\u0027re not thinking of block sizes larger than 4K rather than sector sizes?\n\nCan you provide an example of a drive with a sector size larger than 4K?","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"},{"author":{"_account_id":8768,"name":"Chris Friesen","email":"chris.friesen@windriver.com","username":"cbf123"},"change_message_id":"f8ba868bac75fc9552881ba237632d9315fd6192","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_3084bcb1","line":47,"in_reply_to":"3f79a3b5_7006b4ce","updated":"2018-11-09 17:24:37.000000000","message":"So per http://man7.org/linux/man-pages/man2/open.2.html, we need to use a multiple of \"the logical block size of the underlying storage\" which I think would be the sector size for a \"real\" disk.\n\nFor network-attached storage this may be a bit more slippery.","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"},{"author":{"_account_id":28332,"name":"Alexandre arents","email":"alexandre.arents@corp.ovh.com","username":"aarents"},"change_message_id":"01c4e545c381e4f88ef0a1fb6b2fd7e32c651784","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_19753297","line":47,"in_reply_to":"3f79a3b5_de96cba0","updated":"2018-11-09 13:48:21.000000000","message":"not sure it is necessary, I don\u0027t see the case where if it fail with 4096, it will not at 512?\n\n4096 is less restrictive than 512 because as it will support block dev sector size of 512,1024,2048,4096.(because IO size is multiple of sector size)\n\nextra thought:\nThe application doing DIRECT IO (qemu here) is responsible of choosing the correct optimized minimum io size according bock size of underlying bock_dev (and maybe mem PAGE_SIZE). if qemu for some obvious reason was staticly using 512b, this test was fine for caught the issue before start qemu, but qemu seems fine doing  direct io with 4096.","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"02806ba4da88acfca0038481b9ed1126150085a7","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    try:"},{"line_number":45,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)"},{"line_number":46,"context_line":"        # Check is the write allowed with 4096 byte alignment"},{"line_number":47,"context_line":"        align_size \u003d 4096"},{"line_number":48,"context_line":"        m \u003d mmap.mmap(-1, align_size)"},{"line_number":49,"context_line":"        m.write(b\"x\" * align_size)"},{"line_number":50,"context_line":"        os.write(fd, m)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_7256c62d","line":47,"in_reply_to":"3f79a3b5_de96cba0","updated":"2018-11-09 05:55:51.000000000","message":"previously worked align with 512 might not work now e.g 1024 \n..","commit_id":"54357f111de2401034f67b07f833a05e9ac9b99a"}]}
