lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 17 Aug 2015 18:23:04 +0530
From:	Navin P <navinp1912@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: Why is SECTOR_SIZE = 512 inside kernel ?

Hi,

 Why is SECTOR_SIZE 512 ?

http://lxr.free-electrons.com/source/include/linux/ide.h#L118

http://lxr.free-electrons.com/source/include/linux/device-mapper.h#L548

548 #define SECTOR_SHIFT 9

I was looking at disks with hw_sector_size . Most of them i looked at
had 512 bytes except for one which had 4096 (virtual disk). The one
with AF format ie has logical sector size as 512 and hw_sector_size as
512 . So it is fine for my calculation from /proc/diskstats.

But the one with 4096 logical and 4096 physical i multiply
hw_sector_size with the sectors read and written but that is wrong
since the kernel always defines sectors in terms of 512.


Is it going to change or is it  cast in stone ?


Here is an example. Again this is a VM virtual disk. vdc is the
subject in interest.


[root@...uge-049 ~]# fdisk -l /dev/vdb /dev/vdc

Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/vdc: 17.2 GB, 17179869184 bytes, 4194304 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

[root@...uge-049 ~]#


[root@...uge-049 ~]# cat /sys/block/vdc/queue/hw_sector_size && cat
/sys/block/vdc/queue/logical_block_size  && cat
/sys/block/vdc/queue/physical_block_size
4096
4096
4096
[root@...uge-049 ~]# cat /sys/block/vdb/queue/hw_sector_size && cat
/sys/block/vdb/queue/logical_block_size  && cat
/sys/block/vdb/queue/physical_block_size
512
512
4096
[root@...uge-049 ~]#



Regards,
Navin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ