All of lore.kernel.org
 help / color / mirror / Atom feed
* Q on ioctl BLKGETSIZE
@ 2014-03-18 12:17 Ulrich Windl
  2014-03-18 15:13 ` tytso
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Windl @ 2014-03-18 12:17 UTC (permalink / raw)
  To: linux-kernel

Hi!

I'm wondering (on a x86_64 SLES11 system):

"man 4 sd" says:
---
       BLKGETSIZE
              Returns the device size  in  sectors.   The  ioctl(2)  parameter
              should be a pointer to a long.
---

/usr/src/linux/block/ioctl.c (3.0.101-0.15) reads:
---
        case BLKGETSIZE:
                size = i_size_read(bdev->bd_inode);
                if ((size >> 9) > ~0UL)
                        return -EFBIG;
                return put_ulong(arg, size >> 9);
---

Three questions:
1) Shouldn't the manual page says that the sector size of always 512 Bytes, even on new disks with larger sectors?
2) Should the real sector size be used for new disks?
3) When using 512-bytes sector size, isn't the capacity limited to 2TB (2^31 kB)?

I'm not subscribed to LKML, so please keep me CC'd when answering.

Regards,
Ulrich



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q on ioctl BLKGETSIZE
  2014-03-18 12:17 Q on ioctl BLKGETSIZE Ulrich Windl
@ 2014-03-18 15:13 ` tytso
  0 siblings, 0 replies; 2+ messages in thread
From: tytso @ 2014-03-18 15:13 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: linux-kernel

On Tue, Mar 18, 2014 at 01:17:25PM +0100, Ulrich Windl wrote:
> 
> Three questions:
> 1) Shouldn't the manual page says that the sector size of always 512 Bytes, even on new disks with larger sectors?
> 2) Should the real sector size be used for new disks?

The HDD industry is using 512 byte logical sectors (so LBA's are in
units of 512 byte sectors), even for disks with a physical sector size
of 4k (and in the next 4-5 years, they would like to go to 32k
physical sector sizes).

> 3) When using 512-bytes sector size, isn't the capacity limited to 2TB (2^31 kB)?

Yes.  That's why we have the BLKGETSIZE64 ioctl.

Example code:

https://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/tree/lib/ext2fs/getsize.c

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-18 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 12:17 Q on ioctl BLKGETSIZE Ulrich Windl
2014-03-18 15:13 ` tytso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.