Skip to content

Commit db01a9d

Browse files
committed
Conflicts: rust/bindings/bindings_helper.h
2 parents 9df2572 + 83215e8 commit db01a9d

File tree

203 files changed

+6573
-4208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+6573
-4208
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ Vivien Didelot <[email protected]> <[email protected]>
689689
690690
691691
692+
692693
693694
694695

Documentation/ABI/stable/sysfs-block

+53
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,59 @@ Description:
2121
device is offset from the internal allocation unit's
2222
natural alignment.
2323

24+
What: /sys/block/<disk>/atomic_write_max_bytes
25+
Date: February 2024
26+
Contact: Himanshu Madhani <[email protected]>
27+
Description:
28+
[RO] This parameter specifies the maximum atomic write
29+
size reported by the device. This parameter is relevant
30+
for merging of writes, where a merged atomic write
31+
operation must not exceed this number of bytes.
32+
This parameter may be greater than the value in
33+
atomic_write_unit_max_bytes as
34+
atomic_write_unit_max_bytes will be rounded down to a
35+
power-of-two and atomic_write_unit_max_bytes may also be
36+
limited by some other queue limits, such as max_segments.
37+
This parameter - along with atomic_write_unit_min_bytes
38+
and atomic_write_unit_max_bytes - will not be larger than
39+
max_hw_sectors_kb, but may be larger than max_sectors_kb.
40+
41+
42+
What: /sys/block/<disk>/atomic_write_unit_min_bytes
43+
Date: February 2024
44+
Contact: Himanshu Madhani <[email protected]>
45+
Description:
46+
[RO] This parameter specifies the smallest block which can
47+
be written atomically with an atomic write operation. All
48+
atomic write operations must begin at a
49+
atomic_write_unit_min boundary and must be multiples of
50+
atomic_write_unit_min. This value must be a power-of-two.
51+
52+
53+
What: /sys/block/<disk>/atomic_write_unit_max_bytes
54+
Date: February 2024
55+
Contact: Himanshu Madhani <[email protected]>
56+
Description:
57+
[RO] This parameter defines the largest block which can be
58+
written atomically with an atomic write operation. This
59+
value must be a multiple of atomic_write_unit_min and must
60+
be a power-of-two. This value will not be larger than
61+
atomic_write_max_bytes.
62+
63+
64+
What: /sys/block/<disk>/atomic_write_boundary_bytes
65+
Date: February 2024
66+
Contact: Himanshu Madhani <[email protected]>
67+
Description:
68+
[RO] A device may need to internally split an atomic write I/O
69+
which straddles a given logical block address boundary. This
70+
parameter specifies the size in bytes of the atomic boundary if
71+
one is reported by the device. This value must be a
72+
power-of-two and at least the size as in
73+
atomic_write_unit_max_bytes.
74+
Any attempt to merge atomic write I/Os must not result in a
75+
merged I/O which crosses this boundary (if any).
76+
2477

2578
What: /sys/block/<disk>/diskseq
2679
Date: February 2021

Documentation/block/data-integrity.rst

+3-46
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,11 @@ bio_free() will automatically free the bip.
153153
4.2 Block Device
154154
----------------
155155

156-
Because the format of the protection data is tied to the physical
157-
disk, each block device has been extended with a block integrity
158-
profile (struct blk_integrity). This optional profile is registered
159-
with the block layer using blk_integrity_register().
160-
161-
The profile contains callback functions for generating and verifying
162-
the protection data, as well as getting and setting application tags.
163-
The profile also contains a few constants to aid in completing,
164-
merging and splitting the integrity metadata.
156+
Block devices can set up the integrity information in the integrity
157+
sub-struture of the queue_limits structure.
165158

166159
Layered block devices will need to pick a profile that's appropriate
167-
for all subdevices. blk_integrity_compare() can help with that. DM
160+
for all subdevices. queue_limits_stack_integrity() can help with that. DM
168161
and MD linear, RAID0 and RAID1 are currently supported. RAID4/5/6
169162
will require extra work due to the application tag.
170163

@@ -250,42 +243,6 @@ will require extra work due to the application tag.
250243
integrity upon completion.
251244

252245

253-
5.4 Registering A Block Device As Capable Of Exchanging Integrity Metadata
254-
--------------------------------------------------------------------------
255-
256-
To enable integrity exchange on a block device the gendisk must be
257-
registered as capable:
258-
259-
`int blk_integrity_register(gendisk, blk_integrity);`
260-
261-
The blk_integrity struct is a template and should contain the
262-
following::
263-
264-
static struct blk_integrity my_profile = {
265-
.name = "STANDARDSBODY-TYPE-VARIANT-CSUM",
266-
.generate_fn = my_generate_fn,
267-
.verify_fn = my_verify_fn,
268-
.tuple_size = sizeof(struct my_tuple_size),
269-
.tag_size = <tag bytes per hw sector>,
270-
};
271-
272-
'name' is a text string which will be visible in sysfs. This is
273-
part of the userland API so chose it carefully and never change
274-
it. The format is standards body-type-variant.
275-
E.g. T10-DIF-TYPE1-IP or T13-EPP-0-CRC.
276-
277-
'generate_fn' generates appropriate integrity metadata (for WRITE).
278-
279-
'verify_fn' verifies that the data buffer matches the integrity
280-
metadata.
281-
282-
'tuple_size' must be set to match the size of the integrity
283-
metadata per sector. I.e. 8 for DIF and EPP.
284-
285-
'tag_size' must be set to identify how many bytes of tag space
286-
are available per hardware sector. For DIF this is either 2 or
287-
0 depending on the value of the Control Mode Page ATO bit.
288-
289246
----------------------------------------------------------------------
290247

291248
2007-12-24 Martin K. Petersen <[email protected]>

Documentation/block/writeback_cache_control.rst

+38-29
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,50 @@ worry if the underlying devices need any explicit cache flushing and how
4646
the Forced Unit Access is implemented. The REQ_PREFLUSH and REQ_FUA flags
4747
may both be set on a single bio.
4848

49+
Feature settings for block drivers
50+
----------------------------------
4951

50-
Implementation details for bio based block drivers
51-
--------------------------------------------------------------
52+
For devices that do not support volatile write caches there is no driver
53+
support required, the block layer completes empty REQ_PREFLUSH requests before
54+
entering the driver and strips off the REQ_PREFLUSH and REQ_FUA bits from
55+
requests that have a payload.
5256

53-
These drivers will always see the REQ_PREFLUSH and REQ_FUA bits as they sit
54-
directly below the submit_bio interface. For remapping drivers the REQ_FUA
55-
bits need to be propagated to underlying devices, and a global flush needs
56-
to be implemented for bios with the REQ_PREFLUSH bit set. For real device
57-
drivers that do not have a volatile cache the REQ_PREFLUSH and REQ_FUA bits
58-
on non-empty bios can simply be ignored, and REQ_PREFLUSH requests without
59-
data can be completed successfully without doing any work. Drivers for
60-
devices with volatile caches need to implement the support for these
61-
flags themselves without any help from the block layer.
57+
For devices with volatile write caches the driver needs to tell the block layer
58+
that it supports flushing caches by setting the
6259

60+
BLK_FEAT_WRITE_CACHE
6361

64-
Implementation details for request_fn based block drivers
65-
---------------------------------------------------------
62+
flag in the queue_limits feature field. For devices that also support the FUA
63+
bit the block layer needs to be told to pass on the REQ_FUA bit by also setting
64+
the
6665

67-
For devices that do not support volatile write caches there is no driver
68-
support required, the block layer completes empty REQ_PREFLUSH requests before
69-
entering the driver and strips off the REQ_PREFLUSH and REQ_FUA bits from
70-
requests that have a payload. For devices with volatile write caches the
71-
driver needs to tell the block layer that it supports flushing caches by
72-
doing::
66+
BLK_FEAT_FUA
67+
68+
flag in the features field of the queue_limits structure.
69+
70+
Implementation details for bio based block drivers
71+
--------------------------------------------------
72+
73+
For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simply passed on to
74+
the driver if the driver sets the BLK_FEAT_WRITE_CACHE flag and the driver
75+
needs to handle them.
76+
77+
*NOTE*: The REQ_FUA bit also gets passed on when the BLK_FEAT_FUA flags is
78+
_not_ set. Any bio based driver that sets BLK_FEAT_WRITE_CACHE also needs to
79+
handle REQ_FUA.
7380

74-
blk_queue_write_cache(sdkp->disk->queue, true, false);
81+
For remapping drivers the REQ_FUA bits need to be propagated to underlying
82+
devices, and a global flush needs to be implemented for bios with the
83+
REQ_PREFLUSH bit set.
7584

76-
and handle empty REQ_OP_FLUSH requests in its prep_fn/request_fn. Note that
77-
REQ_PREFLUSH requests with a payload are automatically turned into a sequence
78-
of an empty REQ_OP_FLUSH request followed by the actual write by the block
79-
layer. For devices that also support the FUA bit the block layer needs
80-
to be told to pass through the REQ_FUA bit using::
85+
Implementation details for blk-mq drivers
86+
-----------------------------------------
8187

82-
blk_queue_write_cache(sdkp->disk->queue, true, true);
88+
When the BLK_FEAT_WRITE_CACHE flag is set, REQ_OP_WRITE | REQ_PREFLUSH requests
89+
with a payload are automatically turned into a sequence of a REQ_OP_FLUSH
90+
request followed by the actual write by the block layer.
8391

84-
and the driver must handle write requests that have the REQ_FUA bit set
85-
in prep_fn/request_fn. If the FUA bit is not natively supported the block
86-
layer turns it into an empty REQ_OP_FLUSH request after the actual write.
92+
When the BLK_FEAT_FUA flags is set, the REQ_FUA bit is simply passed on for the
93+
REQ_OP_WRITE request, else a REQ_OP_FLUSH request is sent by the block layer
94+
after the completion of the write request for bio submissions with the REQ_FUA
95+
bit set.

MAINTAINERS

+15-1
Original file line numberDiff line numberDiff line change
@@ -3780,6 +3780,20 @@ F: include/linux/blk*
37803780
F: kernel/trace/blktrace.c
37813781
F: lib/sbitmap.c
37823782

3783+
BLOCK LAYER DEVICE DRIVER API [RUST]
3784+
M: Andreas Hindborg <[email protected]>
3785+
R: Boqun Feng <[email protected]>
3786+
3787+
3788+
S: Supported
3789+
W: https://rust-for-linux.com
3790+
B: https://github.com/Rust-for-Linux/linux/issues
3791+
C: https://rust-for-linux.zulipchat.com/#narrow/stream/Block
3792+
T: git https://github.com/Rust-for-Linux/linux.git rust-block-next
3793+
F: drivers/block/rnull.rs
3794+
F: rust/kernel/block.rs
3795+
F: rust/kernel/block/
3796+
37833797
BLOCK2MTD DRIVER
37843798
M: Joern Engel <[email protected]>
37853799
@@ -11569,7 +11583,7 @@ F: include/linux/iosys-map.h
1156911583

1157011584
IO_URING
1157111585
M: Jens Axboe <[email protected]>
11572-
R: Pavel Begunkov <[email protected]>
11586+
M: Pavel Begunkov <[email protected]>
1157311587
1157411588
S: Maintained
1157511589
T: git git://git.kernel.dk/linux-block

arch/m68k/emu/nfblock.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void nfhd_submit_bio(struct bio *bio)
7171
len = bvec.bv_len;
7272
len >>= 9;
7373
nfhd_read_write(dev->id, 0, dir, sec >> shift, len >> shift,
74-
page_to_phys(bvec.bv_page) + bvec.bv_offset);
74+
bvec_phys(&bvec));
7575
sec += len;
7676
}
7777
bio_endio(bio);
@@ -98,6 +98,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
9898
{
9999
struct queue_limits lim = {
100100
.logical_block_size = bsize,
101+
.features = BLK_FEAT_ROTATIONAL,
101102
};
102103
struct nfhd_device *dev;
103104
int dev_id = id - NFHD_DEV_OFFSET;

arch/um/drivers/ubd_kern.c

+20-33
Original file line numberDiff line numberDiff line change
@@ -447,43 +447,31 @@ static int bulk_req_safe_read(
447447
return n;
448448
}
449449

450-
/* Called without dev->lock held, and only in interrupt context. */
451-
static void ubd_handler(void)
450+
static void ubd_end_request(struct io_thread_req *io_req)
452451
{
453-
int n;
454-
int count;
455-
456-
while(1){
457-
n = bulk_req_safe_read(
458-
thread_fd,
459-
irq_req_buffer,
460-
&irq_remainder,
461-
&irq_remainder_size,
462-
UBD_REQ_BUFFER_SIZE
463-
);
464-
if (n < 0) {
465-
if(n == -EAGAIN)
466-
break;
467-
printk(KERN_ERR "spurious interrupt in ubd_handler, "
468-
"err = %d\n", -n);
469-
return;
470-
}
471-
for (count = 0; count < n/sizeof(struct io_thread_req *); count++) {
472-
struct io_thread_req *io_req = (*irq_req_buffer)[count];
473-
474-
if ((io_req->error == BLK_STS_NOTSUPP) && (req_op(io_req->req) == REQ_OP_DISCARD)) {
475-
blk_queue_max_discard_sectors(io_req->req->q, 0);
476-
blk_queue_max_write_zeroes_sectors(io_req->req->q, 0);
477-
}
478-
blk_mq_end_request(io_req->req, io_req->error);
479-
kfree(io_req);
480-
}
452+
if (io_req->error == BLK_STS_NOTSUPP) {
453+
if (req_op(io_req->req) == REQ_OP_DISCARD)
454+
blk_queue_disable_discard(io_req->req->q);
455+
else if (req_op(io_req->req) == REQ_OP_WRITE_ZEROES)
456+
blk_queue_disable_write_zeroes(io_req->req->q);
481457
}
458+
blk_mq_end_request(io_req->req, io_req->error);
459+
kfree(io_req);
482460
}
483461

484462
static irqreturn_t ubd_intr(int irq, void *dev)
485463
{
486-
ubd_handler();
464+
int len, i;
465+
466+
while ((len = bulk_req_safe_read(thread_fd, irq_req_buffer,
467+
&irq_remainder, &irq_remainder_size,
468+
UBD_REQ_BUFFER_SIZE)) >= 0) {
469+
for (i = 0; i < len / sizeof(struct io_thread_req *); i++)
470+
ubd_end_request((*irq_req_buffer)[i]);
471+
}
472+
473+
if (len < 0 && len != -EAGAIN)
474+
pr_err("spurious interrupt in %s, err = %d\n", __func__, len);
487475
return IRQ_HANDLED;
488476
}
489477

@@ -847,6 +835,7 @@ static int ubd_add(int n, char **error_out)
847835
struct queue_limits lim = {
848836
.max_segments = MAX_SG,
849837
.seg_boundary_mask = PAGE_SIZE - 1,
838+
.features = BLK_FEAT_WRITE_CACHE,
850839
};
851840
struct gendisk *disk;
852841
int err = 0;
@@ -893,8 +882,6 @@ static int ubd_add(int n, char **error_out)
893882
goto out_cleanup_tags;
894883
}
895884

896-
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
897-
blk_queue_write_cache(disk->queue, true, false);
898885
disk->major = UBD_MAJOR;
899886
disk->first_minor = n << UBD_SHIFT;
900887
disk->minors = 1 << UBD_SHIFT;

arch/xtensa/platforms/iss/simdisk.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ static const struct proc_ops simdisk_proc_ops = {
263263
static int __init simdisk_setup(struct simdisk *dev, int which,
264264
struct proc_dir_entry *procdir)
265265
{
266+
struct queue_limits lim = {
267+
.features = BLK_FEAT_ROTATIONAL,
268+
};
266269
char tmp[2] = { '0' + which, 0 };
267270
int err;
268271

@@ -271,7 +274,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
271274
spin_lock_init(&dev->lock);
272275
dev->users = 0;
273276

274-
dev->gd = blk_alloc_disk(NULL, NUMA_NO_NODE);
277+
dev->gd = blk_alloc_disk(&lim, NUMA_NO_NODE);
275278
if (IS_ERR(dev->gd)) {
276279
err = PTR_ERR(dev->gd);
277280
goto out;

block/Kconfig

+2-6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ config BLK_DEV_BSGLIB
6262

6363
config BLK_DEV_INTEGRITY
6464
bool "Block layer data integrity support"
65+
select CRC_T10DIF
66+
select CRC64_ROCKSOFT
6567
help
6668
Some storage devices allow extra information to be
6769
stored/retrieved to help protect the data. The block layer
@@ -72,12 +74,6 @@ config BLK_DEV_INTEGRITY
7274
T10/SCSI Data Integrity Field or the T13/ATA External Path
7375
Protection. If in doubt, say N.
7476

75-
config BLK_DEV_INTEGRITY_T10
76-
tristate
77-
depends on BLK_DEV_INTEGRITY
78-
select CRC_T10DIF
79-
select CRC64_ROCKSOFT
80-
8177
config BLK_DEV_WRITE_MOUNTED
8278
bool "Allow writing to mounted block devices"
8379
default y

block/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ obj-$(CONFIG_MQ_IOSCHED_KYBER) += kyber-iosched.o
2626
bfq-y := bfq-iosched.o bfq-wf2q.o bfq-cgroup.o
2727
obj-$(CONFIG_IOSCHED_BFQ) += bfq.o
2828

29-
obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o
30-
obj-$(CONFIG_BLK_DEV_INTEGRITY_T10) += t10-pi.o
29+
obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o t10-pi.o
3130
obj-$(CONFIG_BLK_MQ_PCI) += blk-mq-pci.o
3231
obj-$(CONFIG_BLK_MQ_VIRTIO) += blk-mq-virtio.o
3332
obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o

0 commit comments

Comments
 (0)