I've been following this thread intensely. I need to use Network Block
Device to get very large network-RAID. And, resolution to this issue is
of great interest to me.
Judging by 'driver/block/nbd.c', it counts by BLOCK_SIZE=1204
(BLOCK_SIZE_BITS=10), even though you can set the block size to
[512,1024,...,PAGE_SIZE=4096]. Since NBD counts this 1KB block using
'u64' integer, the ultimate size of filesystem is determined by the
kernel block device support.
Looking at 'fs/block_dev.c', you can set the block size to
[512,1024,...,PAGE_SIZE=4096] also. But, 'max_block()' returns block
count in whatever block size of the device, not in BLOCK_SIZE:
static unsigned long max_block(kdev_t dev)
{
unsigned int retval = ~0U;
int major = MAJOR(dev);
if (blk_size[major]) {
int minor = MINOR(dev);
unsigned int blocks = blk_size[major][minor];
if (blocks) {
unsigned int size = block_size(dev);
unsigned int sizebits = blksize_bits(size);
blocks += (size-1) >> BLOCK_SIZE_BITS;
retval = blocks << (BLOCK_SIZE_BITS - sizebits);
if (sizebits > BLOCK_SIZE_BITS)
retval = blocks >> (sizebits - BLOCK_SIZE_BITS);
}
}
return retval;
}
In particular, if block size is 512, then the block count is multiplied
by 2; and if block size if 4096, then the block count is divided by 4.
It thinks that 'blk_size[][]' is block count in KB. So, I can only
deduce that block count is in KB.
Also, from 'include/linux/blkdev.h',
extern int * blk_size[MAX_BLKDEV];
'blk_size[][]' is 'int', which means maximum size of block device is
2^10 x 2^31 = 2^41 = 2TB. However, because it is always converted to
'unsigned int' for block count calculation, I think you can take it as
4TB.
Am I right?
-- William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>. 8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/