You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
block: Do away with the notion of hardsect_size
Until now we have had a 1:1 mapping between storage device physical block size and the logical block sized used when addressing the device. With SATA 4KB drives coming out that will no longer be the case. The sector size will be 4KB but the logical block size will remain 512-bytes. Hence we need to distinguish between the physical block size and the logical ditto. This patch renames hardsect_size to logical_block_size. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
committed by
Jens Axboe
parent
9bd7de51ee
commit
e1defc4ff0
@@ -340,7 +340,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
|
||||
kobject_uevent(&bi->kobj, KOBJ_ADD);
|
||||
|
||||
bi->flags |= INTEGRITY_FLAG_READ | INTEGRITY_FLAG_WRITE;
|
||||
bi->sector_size = disk->queue->hardsect_size;
|
||||
bi->sector_size = queue_logical_block_size(disk->queue);
|
||||
disk->integrity = bi;
|
||||
} else
|
||||
bi = disk->integrity;
|
||||
|
||||
+10
-11
@@ -134,7 +134,7 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
|
||||
q->backing_dev_info.state = 0;
|
||||
q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY;
|
||||
blk_queue_max_sectors(q, SAFE_MAX_SECTORS);
|
||||
blk_queue_hardsect_size(q, 512);
|
||||
blk_queue_logical_block_size(q, 512);
|
||||
blk_queue_dma_alignment(q, 511);
|
||||
blk_queue_congestion_threshold(q);
|
||||
q->nr_batching = BLK_BATCH_REQ;
|
||||
@@ -288,21 +288,20 @@ void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size)
|
||||
EXPORT_SYMBOL(blk_queue_max_segment_size);
|
||||
|
||||
/**
|
||||
* blk_queue_hardsect_size - set hardware sector size for the queue
|
||||
* blk_queue_logical_block_size - set logical block size for the queue
|
||||
* @q: the request queue for the device
|
||||
* @size: the hardware sector size, in bytes
|
||||
* @size: the logical block size, in bytes
|
||||
*
|
||||
* Description:
|
||||
* This should typically be set to the lowest possible sector size
|
||||
* that the hardware can operate on (possible without reverting to
|
||||
* even internal read-modify-write operations). Usually the default
|
||||
* of 512 covers most hardware.
|
||||
* This should be set to the lowest possible block size that the
|
||||
* storage device can address. The default of 512 covers most
|
||||
* hardware.
|
||||
**/
|
||||
void blk_queue_hardsect_size(struct request_queue *q, unsigned short size)
|
||||
void blk_queue_logical_block_size(struct request_queue *q, unsigned short size)
|
||||
{
|
||||
q->hardsect_size = size;
|
||||
q->logical_block_size = size;
|
||||
}
|
||||
EXPORT_SYMBOL(blk_queue_hardsect_size);
|
||||
EXPORT_SYMBOL(blk_queue_logical_block_size);
|
||||
|
||||
/*
|
||||
* Returns the minimum that is _not_ zero, unless both are zero.
|
||||
@@ -324,7 +323,7 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
|
||||
t->max_phys_segments = min_not_zero(t->max_phys_segments, b->max_phys_segments);
|
||||
t->max_hw_segments = min_not_zero(t->max_hw_segments, b->max_hw_segments);
|
||||
t->max_segment_size = min_not_zero(t->max_segment_size, b->max_segment_size);
|
||||
t->hardsect_size = max(t->hardsect_size, b->hardsect_size);
|
||||
t->logical_block_size = max(t->logical_block_size, b->logical_block_size);
|
||||
if (!t->queue_lock)
|
||||
WARN_ON_ONCE(1);
|
||||
else if (!test_bit(QUEUE_FLAG_CLUSTER, &b->queue_flags)) {
|
||||
|
||||
+9
-3
@@ -100,9 +100,9 @@ static ssize_t queue_max_sectors_show(struct request_queue *q, char *page)
|
||||
return queue_var_show(max_sectors_kb, (page));
|
||||
}
|
||||
|
||||
static ssize_t queue_hw_sector_size_show(struct request_queue *q, char *page)
|
||||
static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page)
|
||||
{
|
||||
return queue_var_show(q->hardsect_size, page);
|
||||
return queue_var_show(queue_logical_block_size(q), page);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
@@ -249,7 +249,12 @@ static struct queue_sysfs_entry queue_iosched_entry = {
|
||||
|
||||
static struct queue_sysfs_entry queue_hw_sector_size_entry = {
|
||||
.attr = {.name = "hw_sector_size", .mode = S_IRUGO },
|
||||
.show = queue_hw_sector_size_show,
|
||||
.show = queue_logical_block_size_show,
|
||||
};
|
||||
|
||||
static struct queue_sysfs_entry queue_logical_block_size_entry = {
|
||||
.attr = {.name = "logical_block_size", .mode = S_IRUGO },
|
||||
.show = queue_logical_block_size_show,
|
||||
};
|
||||
|
||||
static struct queue_sysfs_entry queue_nonrot_entry = {
|
||||
@@ -283,6 +288,7 @@ static struct attribute *default_attrs[] = {
|
||||
&queue_max_sectors_entry.attr,
|
||||
&queue_iosched_entry.attr,
|
||||
&queue_hw_sector_size_entry.attr,
|
||||
&queue_logical_block_size_entry.attr,
|
||||
&queue_nonrot_entry.attr,
|
||||
&queue_nomerges_entry.attr,
|
||||
&queue_rq_affinity_entry.attr,
|
||||
|
||||
@@ -763,7 +763,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */
|
||||
return compat_put_int(arg, block_size(bdev));
|
||||
case BLKSSZGET: /* get block device hardware sector size */
|
||||
return compat_put_int(arg, bdev_hardsect_size(bdev));
|
||||
return compat_put_int(arg, bdev_logical_block_size(bdev));
|
||||
case BLKSECTGET:
|
||||
return compat_put_ushort(arg,
|
||||
bdev_get_queue(bdev)->max_sectors);
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
|
||||
case BLKBSZGET: /* get the logical block size (cf. BLKSSZGET) */
|
||||
return put_int(arg, block_size(bdev));
|
||||
case BLKSSZGET: /* get block device hardware sector size */
|
||||
return put_int(arg, bdev_hardsect_size(bdev));
|
||||
return put_int(arg, bdev_logical_block_size(bdev));
|
||||
case BLKSECTGET:
|
||||
return put_ushort(arg, bdev_get_queue(bdev)->max_sectors);
|
||||
case BLKRASET:
|
||||
|
||||
Reference in New Issue
Block a user