Skip to content

Commit c1440ed

Browse files
committed
Merge branch 'for-6.11/block' into for-next
* for-6.11/block: block: move dma_pad_mask into queue_limits block: remove the fallback case in queue_dma_alignment block: remove disk_update_readahead block: conding style fixup for blk_queue_max_guaranteed_bio block: convert features and flags to __bitwise types block: rename BLK_FEAT_MISALIGNED block: correctly report cache type md: set md-specific flags for all queue limits
2 parents 72e9cd9 + e94b45d commit c1440ed

File tree

17 files changed

+99
-111
lines changed

17 files changed

+99
-111
lines changed

block/bio-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes,
334334
u32 seed)
335335
{
336336
struct request_queue *q = bdev_get_queue(bio->bi_bdev);
337-
unsigned int align = q->dma_pad_mask | queue_dma_alignment(q);
337+
unsigned int align = blk_lim_dma_alignment_and_pad(&q->limits);
338338
struct page *stack_pages[UIO_FASTIOV], **pages = stack_pages;
339339
struct bio_vec stack_vec[UIO_FASTIOV], *bvec = stack_vec;
340340
unsigned int direction, nr_bvecs;

block/blk-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
634634
const struct iov_iter *iter, gfp_t gfp_mask)
635635
{
636636
bool copy = false, map_bvec = false;
637-
unsigned long align = q->dma_pad_mask | queue_dma_alignment(q);
637+
unsigned long align = blk_lim_dma_alignment_and_pad(&q->limits);
638638
struct bio *bio = NULL;
639639
struct iov_iter i;
640640
int ret = -EINVAL;

block/blk-settings.c

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
5555
}
5656
EXPORT_SYMBOL(blk_set_stacking_limits);
5757

58-
static void blk_apply_bdi_limits(struct backing_dev_info *bdi,
58+
void blk_apply_bdi_limits(struct backing_dev_info *bdi,
5959
struct queue_limits *lim)
6060
{
6161
/*
@@ -142,8 +142,7 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
142142
* so we assume that we can fit in at least PAGE_SIZE in a segment, apart from
143143
* the first and last segments.
144144
*/
145-
static
146-
unsigned int blk_queue_max_guaranteed_bio(struct queue_limits *lim)
145+
static unsigned int blk_queue_max_guaranteed_bio(struct queue_limits *lim)
147146
{
148147
unsigned int max_segments = min(BIO_MAX_VECS, lim->max_segments);
149148
unsigned int length;
@@ -351,7 +350,7 @@ static int blk_validate_limits(struct queue_limits *lim)
351350

352351
if (lim->alignment_offset) {
353352
lim->alignment_offset &= (lim->physical_block_size - 1);
354-
lim->features &= ~BLK_FEAT_MISALIGNED;
353+
lim->flags &= ~BLK_FLAG_MISALIGNED;
355354
}
356355

357356
if (!(lim->features & BLK_FEAT_WRITE_CACHE))
@@ -435,12 +434,6 @@ int queue_limits_set(struct request_queue *q, struct queue_limits *lim)
435434
}
436435
EXPORT_SYMBOL_GPL(queue_limits_set);
437436

438-
void disk_update_readahead(struct gendisk *disk)
439-
{
440-
blk_apply_bdi_limits(disk->bdi, &disk->queue->limits);
441-
}
442-
EXPORT_SYMBOL_GPL(disk_update_readahead);
443-
444437
/**
445438
* blk_limits_io_min - set minimum request size for a device
446439
* @limits: the queue limits
@@ -564,7 +557,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
564557
if (!(b->features & BLK_FEAT_POLL))
565558
t->features &= ~BLK_FEAT_POLL;
566559

567-
t->flags |= (b->flags & BLK_FEAT_MISALIGNED);
560+
t->flags |= (b->flags & BLK_FLAG_MISALIGNED);
568561

569562
t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
570563
t->max_user_sectors = min_not_zero(t->max_user_sectors,
@@ -603,7 +596,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
603596

604597
/* Verify that top and bottom intervals line up */
605598
if (max(top, bottom) % min(top, bottom)) {
606-
t->flags |= BLK_FEAT_MISALIGNED;
599+
t->flags |= BLK_FLAG_MISALIGNED;
607600
ret = -1;
608601
}
609602
}
@@ -625,28 +618,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
625618
/* Physical block size a multiple of the logical block size? */
626619
if (t->physical_block_size & (t->logical_block_size - 1)) {
627620
t->physical_block_size = t->logical_block_size;
628-
t->flags |= BLK_FEAT_MISALIGNED;
621+
t->flags |= BLK_FLAG_MISALIGNED;
629622
ret = -1;
630623
}
631624

632625
/* Minimum I/O a multiple of the physical block size? */
633626
if (t->io_min & (t->physical_block_size - 1)) {
634627
t->io_min = t->physical_block_size;
635-
t->flags |= BLK_FEAT_MISALIGNED;
628+
t->flags |= BLK_FLAG_MISALIGNED;
636629
ret = -1;
637630
}
638631

639632
/* Optimal I/O a multiple of the physical block size? */
640633
if (t->io_opt & (t->physical_block_size - 1)) {
641634
t->io_opt = 0;
642-
t->flags |= BLK_FEAT_MISALIGNED;
635+
t->flags |= BLK_FLAG_MISALIGNED;
643636
ret = -1;
644637
}
645638

646639
/* chunk_sectors a multiple of the physical block size? */
647640
if ((t->chunk_sectors << 9) & (t->physical_block_size - 1)) {
648641
t->chunk_sectors = 0;
649-
t->flags |= BLK_FEAT_MISALIGNED;
642+
t->flags |= BLK_FLAG_MISALIGNED;
650643
ret = -1;
651644
}
652645

@@ -656,7 +649,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
656649

657650
/* Verify that new alignment_offset is on a logical block boundary */
658651
if (t->alignment_offset & (t->logical_block_size - 1)) {
659-
t->flags |= BLK_FEAT_MISALIGNED;
652+
t->flags |= BLK_FLAG_MISALIGNED;
660653
ret = -1;
661654
}
662655

@@ -775,23 +768,6 @@ bool queue_limits_stack_integrity(struct queue_limits *t,
775768
}
776769
EXPORT_SYMBOL_GPL(queue_limits_stack_integrity);
777770

778-
/**
779-
* blk_queue_update_dma_pad - update pad mask
780-
* @q: the request queue for the device
781-
* @mask: pad mask
782-
*
783-
* Update dma pad mask.
784-
*
785-
* Appending pad buffer to a request modifies the last entry of a
786-
* scatter list such that it includes the pad buffer.
787-
**/
788-
void blk_queue_update_dma_pad(struct request_queue *q, unsigned int mask)
789-
{
790-
if (mask > q->dma_pad_mask)
791-
q->dma_pad_mask = mask;
792-
}
793-
EXPORT_SYMBOL(blk_queue_update_dma_pad);
794-
795771
/**
796772
* blk_set_queue_depth - tell the block layer about the device queue depth
797773
* @q: the request queue for the device
@@ -809,7 +785,7 @@ int bdev_alignment_offset(struct block_device *bdev)
809785
{
810786
struct request_queue *q = bdev_get_queue(bdev);
811787

812-
if (q->limits.flags & BLK_FEAT_MISALIGNED)
788+
if (q->limits.flags & BLK_FLAG_MISALIGNED)
813789
return -1;
814790
if (bdev_is_partition(bdev))
815791
return queue_limit_alignment_offset(&q->limits,

block/blk-sysfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static ssize_t queue_dma_alignment_show(struct request_queue *q, char *page)
288288
}
289289

290290
static ssize_t queue_feature_store(struct request_queue *q, const char *page,
291-
size_t count, unsigned int feature)
291+
size_t count, blk_features_t feature)
292292
{
293293
struct queue_limits lim;
294294
unsigned long val;
@@ -418,7 +418,7 @@ static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page,
418418

419419
static ssize_t queue_poll_show(struct request_queue *q, char *page)
420420
{
421-
return queue_var_show(q->limits.features & BLK_FEAT_POLL, page);
421+
return queue_var_show(!!(q->limits.features & BLK_FEAT_POLL), page);
422422
}
423423

424424
static ssize_t queue_poll_store(struct request_queue *q, const char *page,
@@ -453,9 +453,9 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,
453453

454454
static ssize_t queue_wc_show(struct request_queue *q, char *page)
455455
{
456-
if (q->limits.features & BLK_FLAG_WRITE_CACHE_DISABLED)
457-
return sprintf(page, "write through\n");
458-
return sprintf(page, "write back\n");
456+
if (blk_queue_write_cache(q))
457+
return sprintf(page, "write back\n");
458+
return sprintf(page, "write through\n");
459459
}
460460

461461
static ssize_t queue_wc_store(struct request_queue *q, const char *page,
@@ -492,7 +492,7 @@ static ssize_t queue_fua_show(struct request_queue *q, char *page)
492492

493493
static ssize_t queue_dax_show(struct request_queue *q, char *page)
494494
{
495-
return queue_var_show(blk_queue_dax(q), page);
495+
return queue_var_show(!!blk_queue_dax(q), page);
496496
}
497497

498498
#define QUEUE_RO_ENTRY(_prefix, _name) \

block/blk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio);
358358
enum elv_merge blk_try_merge(struct request *rq, struct bio *bio);
359359

360360
int blk_set_default_limits(struct queue_limits *lim);
361+
void blk_apply_bdi_limits(struct backing_dev_info *bdi,
362+
struct queue_limits *lim);
361363
int blk_dev_init(void);
362364

363365
/*

block/genhd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
524524
disk->part0->bd_dev = MKDEV(disk->major, disk->first_minor);
525525
}
526526

527-
disk_update_readahead(disk);
527+
blk_apply_bdi_limits(disk->bdi, &disk->queue->limits);
528528
disk_add_events(disk);
529529
set_bit(GD_ADDED, &disk->state);
530530
return 0;

drivers/ata/libata-scsi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,6 @@ EXPORT_SYMBOL_GPL(ata_scsi_dma_need_drain);
10241024
int ata_scsi_dev_config(struct scsi_device *sdev, struct queue_limits *lim,
10251025
struct ata_device *dev)
10261026
{
1027-
struct request_queue *q = sdev->request_queue;
10281027
int depth = 1;
10291028

10301029
if (!ata_id_has_unload(dev->id))
@@ -1038,7 +1037,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct queue_limits *lim,
10381037
sdev->sector_size = ATA_SECT_SIZE;
10391038

10401039
/* set DMA padding */
1041-
blk_queue_update_dma_pad(q, ATA_DMA_PAD_SZ - 1);
1040+
lim->dma_pad_mask = ATA_DMA_PAD_SZ - 1;
10421041

10431042
/* make room for appending the drain */
10441043
lim->max_segments--;

drivers/ata/pata_macio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ static int pata_macio_device_configure(struct scsi_device *sdev,
816816
/* OHare has issues with non cache aligned DMA on some chipsets */
817817
if (priv->kind == controller_ohare) {
818818
lim->dma_alignment = 31;
819-
blk_queue_update_dma_pad(sdev->request_queue, 31);
819+
lim->dma_pad_mask = 31;
820820

821821
/* Tell the world about it */
822822
ata_dev_info(dev, "OHare alignment limits applied\n");
@@ -831,7 +831,7 @@ static int pata_macio_device_configure(struct scsi_device *sdev,
831831
if (priv->kind == controller_sh_ata6 || priv->kind == controller_k2_ata6) {
832832
/* Allright these are bad, apply restrictions */
833833
lim->dma_alignment = 15;
834-
blk_queue_update_dma_pad(sdev->request_queue, 15);
834+
lim->dma_pad_mask = 15;
835835

836836
/* We enable MWI and hack cache line size directly here, this
837837
* is specific to this chipset and not normal values, we happen

drivers/md/md.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5853,6 +5853,14 @@ static void mddev_delayed_delete(struct work_struct *ws)
58535853
kobject_put(&mddev->kobj);
58545854
}
58555855

5856+
void md_init_stacking_limits(struct queue_limits *lim)
5857+
{
5858+
blk_set_stacking_limits(lim);
5859+
lim->features = BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA |
5860+
BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT;
5861+
}
5862+
EXPORT_SYMBOL_GPL(md_init_stacking_limits);
5863+
58565864
struct mddev *md_alloc(dev_t dev, char *name)
58575865
{
58585866
/*
@@ -5871,10 +5879,6 @@ struct mddev *md_alloc(dev_t dev, char *name)
58715879
int shift;
58725880
int unit;
58735881
int error;
5874-
struct queue_limits lim = {
5875-
.features = BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA |
5876-
BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT,
5877-
};
58785882

58795883
/*
58805884
* Wait for any previous instance of this device to be completely
@@ -5914,7 +5918,7 @@ struct mddev *md_alloc(dev_t dev, char *name)
59145918
*/
59155919
mddev->hold_active = UNTIL_STOP;
59165920

5917-
disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
5921+
disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
59185922
if (IS_ERR(disk)) {
59195923
error = PTR_ERR(disk);
59205924
goto out_free_mddev;

drivers/md/md.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
893893

894894
extern int mddev_init(struct mddev *mddev);
895895
extern void mddev_destroy(struct mddev *mddev);
896+
void md_init_stacking_limits(struct queue_limits *lim);
896897
struct mddev *md_alloc(dev_t dev, char *name);
897898
void mddev_put(struct mddev *mddev);
898899
extern int md_run(struct mddev *mddev);

0 commit comments

Comments
 (0)