projects/linux·commit 3fc9d690

Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block

3fc9d690 · Linus Torvalds <[email protected]> · 2016-07-26 15:37:51 -07:00

Pull block driver updates from Jens Axboe:
 "This branch also contains core changes.  I've come to the conclusion
  that from 4.9 and forward, I'll be doing just a single branch.  We
  often have dependencies between core and drivers, and it's hard to
  always split them up appropriately without pulling core into drivers
  when that happens.

  That said, this contains:

   - separate secure erase type for the core block layer, from
     Christoph.

   - set of discard fixes, from Christoph.

   - bio shrinking fixes from Christoph, as a followup up to the
     op/flags change in the core branch.

   - map and append request fixes from Christoph.

   - NVMeF (NVMe over Fabrics) code from Christoph.  This is pretty
     exciting!

   - nvme-loop fixes from Arnd.

   - removal of ->driverfs_dev from Dan, after providing a
     device_add_disk() helper.

   - bcache fixes from Bhaktipriya and Yijing.

   - cdrom subchannel read fix from Vchannaiah.

   - set of lightnvm updates from Wenwei, Matias, Johannes, and Javier.

   - set of drbd updates and fixes from Fabian, Lars, and Philipp.

   - mg_disk error path fix from Bart.

   - user notification for failed device add for loop, from Minfei.

   - NVMe in general:
        + NVMe delay quirk from Guilherme.
        + SR-IOV support and command retry limits from Keith.
        + fix for memory-less NUMA node from Masayoshi.
        + use UINT_MAX for discard sectors, from Minfei.
        + cancel IO fixes from Ming.
        + don't allocate unused major, from Neil.
        + error code fixup from Dan.
        + use constants for PSDT/FUSE from James.
        + variable init fix from Jay.
        + fabrics fixes from Ming, Sagi, and Wei.
        + various fixes"

* 'for-4.8/drivers' of git://git.kernel.dk/linux-block: (115 commits)
  nvme/pci: Provide SR-IOV support
  nvme: initialize variable before logical OR'ing it
  block: unexport various bio mapping helpers
  scsi/osd: open code blk_make_request
  target: stop using blk_make_request
  block: simplify and export blk_rq_append_bio
  block: ensure bios return from blk_get_request are properly initialized
  virtio_blk: use blk_rq_map_kern
  memstick: don't allow REQ_TYPE_BLOCK_PC requests
  block: shrink bio size again
  block: simplify and cleanup bvec pool handling
  block: get rid of bio_rw and READA
  block: don't ignore -EOPNOTSUPP blkdev_issue_write_same
  block: introduce BLKDEV_DISCARD_ZERO to fix zeroout
  NVMe: don't allocate unused nvme_major
  nvme: avoid crashes when node 0 is memoryless node.
  nvme: Limit command retries
  loop: Make user notify for adding loop device failed
  nvme-loop: fix nvme-loop Kconfig dependencies
  nvmet: fix return value check in nvmet_subsys_alloc()
  ...
Commit
3fc9d690936fb2e20e180710965ba2cc3a0881f8
Parents
d05d7f40 · 13880f5b

Merge commit. Changes below are compared with the first parent: d05d7f40.

Changes

129 files changed · +11613 −1279

FileStatusAddDelContent
Documentation/ioctl/cdrom.txtmodified+2−1View file
MAINTAINERSmodified+7−0View file
arch/powerpc/sysdev/axonram.cmodified+1−2View file
arch/um/drivers/ubd_kern.cmodified+3−2View file
block/bio-integrity.cmodified+4−5View file
block/bio.cmodified+18−17View file
block/blk-core.cmodified+25−72View file
block/blk-lib.cmodified+26−18View file
block/blk-map.cmodified+15−10View file
block/blk-merge.cmodified+2−4View file
block/blk-mq-tag.cmodified+26−0View file
block/blk-mq.cmodified+43−0View file
block/blk.hmodified+0−2View file
block/genhd.cmodified+9−9View file
drivers/block/brd.cmodified+1−3View file
drivers/block/cciss.cmodified+1−2View file
drivers/block/drbd/drbd_actlog.cmodified+23−6View file
drivers/block/drbd/drbd_bitmap.cmodified+62−22View file
drivers/block/drbd/drbd_debugfs.cmodified+4−9View file
drivers/block/drbd/drbd_int.hmodified+35−14View file
drivers/block/drbd/drbd_interval.hmodified+7−7View file
drivers/block/drbd/drbd_main.cmodified+101−14View file
drivers/block/drbd/drbd_nl.cmodified+219−63View file
drivers/block/drbd/drbd_proc.cmodified+15−15View file
drivers/block/drbd/drbd_protocol.hmodified+74−3View file
drivers/block/drbd/drbd_receiver.cmodified+444−91View file
drivers/block/drbd/drbd_req.cmodified+83−35View file
drivers/block/drbd/drbd_req.hmodified+4−1View file
drivers/block/drbd/drbd_state.cmodified+48−13View file
drivers/block/drbd/drbd_state.hmodified+1−1View file
drivers/block/drbd/drbd_strings.cmodified+4−4View file
drivers/block/drbd/drbd_worker.cmodified+94−21View file
drivers/block/floppy.cmodified+1−2View file
drivers/block/loop.cmodified+1−0View file
drivers/block/mg_disk.cmodified+3−6View file
drivers/block/mtip32xx/mtip32xx.cmodified+2−3View file
drivers/block/null_blk.cmodified+1−1View file
drivers/block/ps3disk.cmodified+1−2View file
drivers/block/ps3vram.cmodified+1−2View file
drivers/block/rsxx/dev.cmodified+1−3View file
drivers/block/skd_main.cmodified+3−5View file
drivers/block/sunvdc.cmodified+1−2View file
drivers/block/umem.cmodified+2−4View file
drivers/block/virtio_blk.cmodified+10−14View file
drivers/block/xen-blkback/xenbus.cmodified+1−1View file
drivers/block/xen-blkfront.cmodified+10−8View file
drivers/cdrom/cdrom.cmodified+19−9View file
drivers/ide/ide-cd.cmodified+1−2View file
drivers/ide/ide-gd.cmodified+1−2View file
drivers/lightnvm/Kconfigmodified+6−4View file
drivers/lightnvm/core.cmodified+60−182View file
drivers/lightnvm/gennvm.cmodified+248−137View file
drivers/lightnvm/gennvm.hmodified+7−3View file
drivers/lightnvm/rrpc.cmodified+75−74View file
drivers/lightnvm/rrpc.hmodified+3−10View file
drivers/lightnvm/sysblk.cmodified+5−3View file
drivers/md/bcache/closure.cmodified+1−1View file
drivers/md/bcache/closure.hmodified+2−1View file
drivers/md/bcache/io.cmodified+0−1View file
drivers/md/bcache/super.cmodified+5−5View file
drivers/md/dm-raid1.cmodified+4−4View file
drivers/md/dm-snap.cmodified+7−6View file
drivers/md/dm-zero.cmodified+9−6View file
drivers/md/dm.cmodified+1−1View file
drivers/md/raid1.cmodified+2−3View file
drivers/md/raid10.cmodified+2−3View file
drivers/md/raid5.cmodified+1−1View file
drivers/memstick/core/ms_block.cmodified+2−4View file
drivers/memstick/core/mspro_block.cmodified+2−4View file
drivers/mmc/card/block.cmodified+9−6View file
drivers/mmc/card/queue.cmodified+1−1View file
drivers/mtd/mtd_blkdevs.cmodified+1−3View file
drivers/nvdimm/blk.cmodified+1−2View file
drivers/nvdimm/btt.cmodified+1−2View file
drivers/nvdimm/bus.cmodified+1−1View file
drivers/nvdimm/pmem.cmodified+1−2View file
drivers/nvme/Kconfigmodified+1−0View file
drivers/nvme/Makefilemodified+1−0View file
drivers/nvme/host/Kconfigmodified+19−0View file
drivers/nvme/host/Makefilemodified+6−0View file
drivers/nvme/host/core.cmodified+269−49View file
drivers/nvme/host/fabrics.cadded+952−0View file
drivers/nvme/host/fabrics.hadded+132−0View file
drivers/nvme/host/lightnvm.cmodified+2−2View file
drivers/nvme/host/nvme.hmodified+45−3View file
drivers/nvme/host/pci.cmodified+36−32View file
drivers/nvme/host/rdma.cadded+2018−0View file
drivers/nvme/target/Kconfigadded+36−0View file
drivers/nvme/target/Makefileadded+9−0View file
drivers/nvme/target/admin-cmd.cadded+465−0View file
drivers/nvme/target/configfs.cadded+917−0View file
drivers/nvme/target/core.cadded+964−0View file
drivers/nvme/target/discovery.cadded+221−0View file
drivers/nvme/target/fabrics-cmd.cadded+240−0View file
drivers/nvme/target/io-cmd.cadded+215−0View file
drivers/nvme/target/loop.cadded+754−0View file
drivers/nvme/target/nvmet.hadded+331−0View file
drivers/nvme/target/rdma.cadded+1448−0View file
drivers/s390/block/dasd_genhd.cmodified+1−2View file
drivers/s390/block/dcssblk.cmodified+1−2View file
drivers/s390/block/scm_blk.cmodified+1−2View file
drivers/scsi/osd/osd_initiator.cmodified+16−9View file
drivers/scsi/sd.cmodified+1−2View file
drivers/scsi/sr.cmodified+1−2View file
drivers/target/target_core_pscsi.cmodified+34−53View file
fs/buffer.cmodified+6−6View file
fs/f2fs/checkpoint.cmodified+1−1View file
fs/f2fs/gc.cmodified+2−1View file
fs/f2fs/node.cmodified+1−1View file
fs/gfs2/bmap.cmodified+2−1View file
fs/gfs2/dir.cmodified+1−1View file
fs/gfs2/meta_io.cmodified+1−1View file
fs/reiserfs/stree.cmodified+1−1View file
fs/udf/dir.cmodified+1−1View file
fs/udf/directory.cmodified+1−1View file
include/linux/bio.hmodified+0−2View file
include/linux/blk-mq.hmodified+5−0View file
include/linux/blk_types.hmodified+18−13View file
include/linux/blkdev.hmodified+8−22View file
include/linux/drbd.hmodified+9−1View file
include/linux/drbd_genl.hmodified+4−3View file
include/linux/drbd_limits.hmodified+13−2View file
include/linux/fs.hmodified+1−17View file
include/linux/genhd.hmodified+6−2View file
include/linux/lightnvm.hmodified+16−18View file
include/linux/nvme-rdma.hadded+71−0View file
include/linux/nvme.hmodified+386−20View file
include/trace/events/f2fs.hmodified+2−2View file
kernel/trace/blktrace.cmodified+4−2View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/ioctl/cdrom.txt

View file
diff --git a/Documentation/ioctl/cdrom.txt b/Documentation/ioctl/cdrom.txt
index 59df81c..a4d62a9 100644
--- a/Documentation/ioctl/cdrom.txt
+++ b/Documentation/ioctl/cdrom.txt
@@ -340,7 +340,8 @@ CDROMSUBCHNL Read subchannel data (struct cdrom_subchnl)
EINVAL format not CDROM_MSF or CDROM_LBA
notes:
- Format is converted to CDROM_MSF on return
+ Format is converted to CDROM_MSF or CDROM_LBA
+ as per user request on return

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index 9987f84..8312586 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8184,6 +8184,13 @@ S: Supported
F: drivers/nvme/host/
F: include/linux/nvme.h
+NVM EXPRESS TARGET DRIVER
+M: Christoph Hellwig <[email protected]>
+M: Sagi Grimberg <[email protected]>
+S: Supported
+F: drivers/nvme/target/
+
NVMEM FRAMEWORK
M: Srinivas Kandagatla <[email protected]>
M: Maxime Ripard <[email protected]>

arch/powerpc/sysdev/axonram.c

View file
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index ff75d70..f9af646 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -223,7 +223,6 @@ static int axon_ram_probe(struct platform_device *device)
bank->disk->first_minor = azfs_minor;
bank->disk->fops = &axon_ram_devops;
bank->disk->private_data = bank;
- bank->disk->driverfs_dev = &device->dev;
sprintf(bank->disk->disk_name, "%s%d",
AXON_RAM_DEVICE_NAME, axon_ram_bank_id);
@@ -238,7 +237,7 @@ static int axon_ram_probe(struct platform_device *device)
set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
- add_disk(bank->disk);
+ device_add_disk(&device->dev, bank->disk);
bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
if (bank->irq_id == NO_IRQ) {

arch/um/drivers/ubd_kern.c

View file
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index ef6b4d9..f354027 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -801,6 +801,7 @@ static void ubd_device_release(struct device *dev)
static int ubd_disk_register(int major, u64 size, int unit,
struct gendisk **disk_out)
{
+ struct device *parent = NULL;
struct gendisk *disk;
disk = alloc_disk(1 << UBD_SHIFT);
@@ -823,12 +824,12 @@ static int ubd_disk_register(int major, u64 size, int unit,
ubd_devs[unit].pdev.dev.release = ubd_device_release;
dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);
platform_device_register(&ubd_devs[unit].pdev);
- disk->driverfs_dev = &ubd_devs[unit].pdev.dev;
+ parent = &ubd_devs[unit].pdev.dev;
}
disk->private_data = &ubd_devs[unit];
disk->queue = ubd_devs[unit].queue;
- add_disk(disk);
+ device_add_disk(parent, disk);
*disk_out = disk;
return 0;

block/bio-integrity.c

View file
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 15d37b1..f70cc3b 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -54,7 +54,6 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
{
struct bio_integrity_payload *bip;
struct bio_set *bs = bio->bi_pool;
- unsigned long idx = BIO_POOL_NONE;
unsigned inline_vecs;
if (!bs || !bs->bio_integrity_pool) {
@@ -72,17 +71,19 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
memset(bip, 0, sizeof(*bip));
if (nr_vecs > inline_vecs) {
+ unsigned long idx = 0;
+
bip->bip_vec = bvec_alloc(gfp_mask, nr_vecs, &idx,
bs->bvec_integrity_pool);
if (!bip->bip_vec)
goto err;
bip->bip_max_vcnt = bvec_nr_vecs(idx);
+ bip->bip_slab = idx;
} else {
bip->bip_vec = bip->bip_inline_vecs;
bip->bip_max_vcnt = inline_vecs;
}
- bip->bip_slab = idx;
bip->bip_bio = bio;
bio->bi_integrity = bip;
bio->bi_rw |= REQ_INTEGRITY;
@@ -111,9 +112,7 @@ void bio_integrity_free(struct bio *bio)
bip->bip_vec->bv_offset);
if (bs && bs->bio_integrity_pool) {
- if (bip->bip_slab != BIO_POOL_NONE)
- bvec_free(bs->bvec_integrity_pool, bip->bip_vec,
- bip->bip_slab);
+ bvec_free(bs->bvec_integrity_pool, bip->bip_vec, bip->bip_slab);
mempool_free(bip, bs->bio_integrity_pool);
} else {

block/bio.c

View file
diff --git a/block/bio.c b/block/bio.c
index 848cd35..54ee384 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -43,7 +43,7 @@
* unsigned short
*/
#define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) }
-static struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly = {
+static struct biovec_slab bvec_slabs[BVEC_POOL_NR] __read_mostly = {
BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES),
};
#undef BV
@@ -160,11 +160,15 @@ unsigned int bvec_nr_vecs(unsigned short idx)
void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned int idx)
{
- BIO_BUG_ON(idx >= BIOVEC_NR_POOLS);
+ if (!idx)
+ return;
+ idx--;
+
+ BIO_BUG_ON(idx >= BVEC_POOL_NR);
- if (idx == BIOVEC_MAX_IDX)
+ if (idx == BVEC_POOL_MAX) {
mempool_free(bv, pool);
- else {
+ } else {
struct biovec_slab *bvs = bvec_slabs + idx;
kmem_cache_free(bvs->slab, bv);
@@ -206,7 +210,7 @@ struct bio_vec *bvec_alloc(gfp_t gfp_mask, int nr, unsigned long *idx,
* idx now points to the pool we want to allocate from. only the
* 1-vec entry pool is mempool backed.
*/
- if (*idx == BIOVEC_MAX_IDX) {
+ if (*idx == BVEC_POOL_MAX) {
fallback:
bvl = mempool_alloc(pool, gfp_mask);
} else {
@@ -226,11 +230,12 @@ fallback:
*/
bvl = kmem_cache_alloc(bvs->slab, __gfp_mask);
if (unlikely(!bvl && (gfp_mask & __GFP_DIRECT_RECLAIM))) {
- *idx = BIOVEC_MAX_IDX;
+ *idx = BVEC_POOL_MAX;
goto fallback;
}
}
+ (*idx)++;
return bvl;
}
@@ -250,8 +255,7 @@ static void bio_free(struct bio *bio)
__bio_free(bio);
if (bs) {
- if (bio_flagged(bio, BIO_OWNS_VEC))
- bvec_free(bs->bvec_pool, bio->bi_io_vec, BIO_POOL_IDX(bio));
+ bvec_free(bs->bvec_pool, bio->bi_io_vec, BVEC_POOL_IDX(bio));
/*
* If we have front padding, adjust the bio pointer before freeing
@@ -420,7 +424,6 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
gfp_t saved_gfp = gfp_mask;
unsigned front_pad;
unsigned inline_vecs;
- unsigned long idx = BIO_POOL_NONE;
struct bio_vec *bvl = NULL;
struct bio *bio;
void *p;
@@ -480,6 +483,8 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
bio_init(bio);
if (nr_iovecs > inline_vecs) {
+ unsigned long idx = 0;
+
bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx, bs->bvec_pool);
if (!bvl && gfp_mask != saved_gfp) {
punt_bios_to_rescuer(bs);
@@ -490,13 +495,12 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
if (unlikely(!bvl))
goto err_free;
- bio_set_flag(bio, BIO_OWNS_VEC);
+ bio->bi_flags |= idx << BVEC_POOL_OFFSET;
} else if (nr_iovecs) {
bvl = bio->bi_inline_vecs;
}
bio->bi_pool = bs;
- bio->bi_flags |= idx << BIO_POOL_OFFSET;
bio->bi_max_vecs = nr_iovecs;
bio->bi_io_vec = bvl;
return bio;
@@ -568,7 +572,7 @@ EXPORT_SYMBOL(bio_phys_segments);
*/
void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
{
- BUG_ON(bio->bi_pool && BIO_POOL_IDX(bio) != BIO_POOL_NONE);
+ BUG_ON(bio->bi_pool && BVEC_POOL_IDX(bio));
/*
* most users will be overriding ->bi_bdev with a new target,
@@ -1097,7 +1101,6 @@ int bio_uncopy_user(struct bio *bio)
bio_put(bio);
return ret;
}
-EXPORT_SYMBOL(bio_uncopy_user);
/**
* bio_copy_user_iov - copy user data to bio
@@ -1392,7 +1395,6 @@ void bio_unmap_user(struct bio *bio)
__bio_unmap_user(bio);
bio_put(bio);
}
-EXPORT_SYMBOL(bio_unmap_user);
static void bio_map_kern_endio(struct bio *bio)
{
@@ -1538,7 +1540,6 @@ cleanup:
bio_put(bio);
return ERR_PTR(-ENOMEM);
}
-EXPORT_SYMBOL(bio_copy_kern);
/*
* bio_set_pages_dirty() and bio_check_pages_dirty() are support functions
@@ -1832,7 +1833,7 @@ EXPORT_SYMBOL_GPL(bio_trim);
*/
mempool_t *biovec_create_pool(int pool_entries)
{
- struct biovec_slab *bp = bvec_slabs + BIOVEC_MAX_IDX;
+ struct biovec_slab *bp = bvec_slabs + BVEC_POOL_MAX;
return mempool_create_slab_pool(pool_entries, bp->slab);
}
@@ -2009,7 +2010,7 @@ static void __init biovec_init_slabs(void)
{
int i;
- for (i = 0; i < BIOVEC_NR_POOLS; i++) {
+ for (i = 0; i < BVEC_POOL_NR; i++) {
int size;
struct biovec_slab *bvs = bvec_slabs + i;

block/blk-core.c

View file
diff --git a/block/blk-core.c b/block/blk-core.c
index 3cfd67d..a687e9c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1294,10 +1294,15 @@ static struct request *blk_old_get_request(struct request_queue *q, int rw,
spin_lock_irq(q->queue_lock);
rq = get_request(q, rw, 0, NULL, gfp_mask);
- if (IS_ERR(rq))
+ if (IS_ERR(rq)) {
spin_unlock_irq(q->queue_lock);
- /* q->queue_lock is unlocked at this point */
+ return rq;
+ }
+ /* q->queue_lock is unlocked at this point */
+ rq->__data_len = 0;
+ rq->__sector = (sector_t) -1;
+ rq->bio = rq->biotail = NULL;
return rq;
}
@@ -1313,63 +1318,6 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask)
EXPORT_SYMBOL(blk_get_request);
/**
- * blk_make_request - given a bio, allocate a corresponding struct request.
- * @q: target request queue
- * @bio: The bio describing the memory mappings that will be submitted for IO.
- * It may be a chained-bio properly constructed by block/bio layer.
- * @gfp_mask: gfp flags to be used for memory allocation
- *
- * blk_make_request is the parallel of generic_make_request for BLOCK_PC
- * type commands. Where the struct request needs to be farther initialized by
- * the caller. It is passed a &struct bio, which describes the memory info of
- * the I/O transfer.
- *
- * The caller of blk_make_request must make sure that bi_io_vec
- * are set to describe the memory buffers. That bio_data_dir() will return
- * the needed direction of the request. (And all bio's in the passed bio-chain
- * are properly set accordingly)
- *
- * If called under none-sleepable conditions, mapped bio buffers must not
- * need bouncing, by calling the appropriate masked or flagged allocator,
- * suitable for the target device. Otherwise the call to blk_queue_bounce will
- * BUG.
- *
- * WARNING: When allocating/cloning a bio-chain, careful consideration should be
- * given to how you allocate bios. In particular, you cannot use
- * __GFP_DIRECT_RECLAIM for anything but the first bio in the chain. Otherwise
- * you risk waiting for IO completion of a bio that hasn't been submitted yet,
- * thus resulting in a deadlock. Alternatively bios should be allocated using
- * bio_kmalloc() instead of bio_alloc(), as that avoids the mempool deadlock.
- * If possible a big IO should be split into smaller parts when allocation
- * fails. Partial allocation should not be an error, or you risk a live-lock.
- */
-struct request *blk_make_request(struct request_queue *q, struct bio *bio,
- gfp_t gfp_mask)
-{
- struct request *rq = blk_get_request(q, bio_data_dir(bio), gfp_mask);
-
- if (IS_ERR(rq))
- return rq;
-
- blk_rq_set_block_pc(rq);
-
- for_each_bio(bio) {
- struct bio *bounce_bio = bio;
- int ret;
-
- blk_queue_bounce(q, &bounce_bio);
- ret = blk_rq_append_bio(q, rq, bounce_bio);
- if (unlikely(ret)) {
- blk_put_request(rq);
- return ERR_PTR(ret);
- }
- }
-
- return rq;
-}
-EXPORT_SYMBOL(blk_make_request);
-
-/**
* blk_rq_set_block_pc - initialize a request to type BLOCK_PC
* @rq: request to be initialized
*
@@ -1377,9 +1325,6 @@ EXPORT_SYMBOL(blk_make_request);
void blk_rq_set_block_pc(struct request *rq)
{
rq->cmd_type = REQ_TYPE_BLOCK_PC;
- rq->__data_len = 0;
- rq->__sector = (sector_t) -1;
- rq->bio = rq->biotail = NULL;
memset(rq->__cmd, 0, sizeof(rq->__cmd));
}
EXPORT_SYMBOL(blk_rq_set_block_pc);
@@ -1982,16 +1927,21 @@ generic_make_request_checks(struct bio *bio)
}
}
- if ((bio_op(bio) == REQ_OP_DISCARD) &&
- (!blk_queue_discard(q) ||
- ((bio->bi_rw & REQ_SECURE) && !blk_queue_secdiscard(q)))) {
- err = -EOPNOTSUPP;
- goto end_io;
- }
-
- if (bio_op(bio) == REQ_OP_WRITE_SAME && !bdev_write_same(bio->bi_bdev)) {
- err = -EOPNOTSUPP;
- goto end_io;
+ switch (bio_op(bio)) {
+ case REQ_OP_DISCARD:
+ if (!blk_queue_discard(q))
+ goto not_supported;
+ break;
+ case REQ_OP_SECURE_ERASE:
+ if (!blk_queue_secure_erase(q))
+ goto not_supported;
+ break;
+ case REQ_OP_WRITE_SAME:
+ if (!bdev_write_same(bio->bi_bdev))
+ goto not_supported;
+ break;
+ default:
+ break;
}
/*
@@ -2008,6 +1958,8 @@ generic_make_request_checks(struct bio *bio)
trace_block_bio_queue(q, bio);
return true;
+not_supported:
+ err = -EOPNOTSUPP;
end_io:
bio->bi_error = err;
bio_endio(bio);
@@ -3383,6 +3335,7 @@ bool blk_poll(struct request_queue *q, blk_qc_t cookie)
return false;
}
+EXPORT_SYMBOL_GPL(blk_poll);
#ifdef CONFIG_PM
/**

block/blk-lib.c

View file
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 9031d2a..083e56f 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -23,20 +23,32 @@ static struct bio *next_bio(struct bio *bio, unsigned int nr_pages,
}
int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
- sector_t nr_sects, gfp_t gfp_mask, int op_flags,
+ sector_t nr_sects, gfp_t gfp_mask, int flags,
struct bio **biop)
{
struct request_queue *q = bdev_get_queue(bdev);
struct bio *bio = *biop;
unsigned int granularity;
+ enum req_op op;
int alignment;
if (!q)
return -ENXIO;
- if (!blk_queue_discard(q))
- return -EOPNOTSUPP;
- if ((op_flags & REQ_SECURE) && !blk_queue_secdiscard(q))
- return -EOPNOTSUPP;
+
+ if (flags & BLKDEV_DISCARD_SECURE) {
+ if (flags & BLKDEV_DISCARD_ZERO)
+ return -EOPNOTSUPP;
+ if (!blk_queue_secure_erase(q))
+ return -EOPNOTSUPP;
+ op = REQ_OP_SECURE_ERASE;
+ } else {
+ if (!blk_queue_discard(q))
+ return -EOPNOTSUPP;
+ if ((flags & BLKDEV_DISCARD_ZERO) &&
+ !q->limits.discard_zeroes_data)
+ return -EOPNOTSUPP;
+ op = REQ_OP_DISCARD;
+ }
/* Zero-sector (unknown) and one-sector granularities are the same. */
granularity = max(q->limits.discard_granularity >> 9, 1U);
@@ -66,7 +78,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
bio = next_bio(bio, 1, gfp_mask);
bio->bi_iter.bi_sector = sector;
bio->bi_bdev = bdev;
- bio_set_op_attrs(bio, REQ_OP_DISCARD, op_flags);
+ bio_set_op_attrs(bio, op, 0);
bio->bi_iter.bi_size = req_sects << 9;
nr_sects -= req_sects;
@@ -100,20 +112,16 @@ EXPORT_SYMBOL(__blkdev_issue_discard);
int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask, unsigned long flags)
{
- int op_flags = 0;
struct bio *bio = NULL;
struct blk_plug plug;
int ret;
- if (flags & BLKDEV_DISCARD_SECURE)
- op_flags |= REQ_SECURE;
-
blk_start_plug(&plug);
- ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, op_flags,
+ ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, flags,
&bio);
if (!ret && bio) {
ret = submit_bio_wait(bio);
- if (ret == -EOPNOTSUPP)
+ if (ret == -EOPNOTSUPP && !(flags & BLKDEV_DISCARD_ZERO))
ret = 0;
bio_put(bio);
}
@@ -173,7 +181,7 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
ret = submit_bio_wait(bio);
bio_put(bio);
}
- return ret != -EOPNOTSUPP ? ret : 0;
+ return ret;
}
EXPORT_SYMBOL(blkdev_issue_write_same);
@@ -244,11 +252,11 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask, bool discard)
{
- struct request_queue *q = bdev_get_queue(bdev);
-
- if (discard && blk_queue_discard(q) && q->limits.discard_zeroes_data &&
- blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, 0) == 0)
- return 0;
+ if (discard) {
+ if (!blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask,
+ BLKDEV_DISCARD_ZERO))
+ return 0;
+ }
if (bdev_write_same(bdev) &&
blkdev_issue_write_same(bdev, sector, nr_sects, gfp_mask,

block/blk-map.c

View file
diff --git a/block/blk-map.c b/block/blk-map.c
index 61733a6..b8657fa 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -9,21 +9,26 @@
#include "blk.h"
-int blk_rq_append_bio(struct request_queue *q, struct request *rq,
- struct bio *bio)
+/*
+ * Append a bio to a passthrough request. Only works can be merged into
+ * the request based on the driver constraints.
+ */
+int blk_rq_append_bio(struct request *rq, struct bio *bio)
{
- if (!rq->bio)
- blk_rq_bio_prep(q, rq, bio);
- else if (!ll_back_merge_fn(q, rq, bio))
- return -EINVAL;
- else {
+ if (!rq->bio) {
+ blk_rq_bio_prep(rq->q, rq, bio);
+ } else {
+ if (!ll_back_merge_fn(rq->q, rq, bio))
+ return -EINVAL;
+
rq->biotail->bi_next = bio;
rq->biotail = bio;
-
rq->__data_len += bio->bi_iter.bi_size;
}
+
return 0;
}
+EXPORT_SYMBOL(blk_rq_append_bio);
static int __blk_rq_unmap_user(struct bio *bio)
{
@@ -71,7 +76,7 @@ static int __blk_rq_map_user_iov(struct request *rq,
*/
bio_get(bio);
- ret = blk_rq_append_bio(q, rq, bio);
+ ret = blk_rq_append_bio(rq, bio);
if (ret) {
bio_endio(bio);
__blk_rq_unmap_user(orig_bio);
@@ -229,7 +234,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
if (do_copy)
rq->cmd_flags |= REQ_COPY_USER;
- ret = blk_rq_append_bio(q, rq, bio);
+ ret = blk_rq_append_bio(rq, bio);
if (unlikely(ret)) {
/* request is too big */
bio_put(bio);

block/blk-merge.c

View file
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 5e4d93e..41cbd48 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -649,8 +649,7 @@ static int attempt_merge(struct request_queue *q, struct request *req,
if (!rq_mergeable(req) || !rq_mergeable(next))
return 0;
- if (!blk_check_merge_flags(req->cmd_flags, req_op(req), next->cmd_flags,
- req_op(next)))
+ if (req_op(req) != req_op(next))
return 0;
/*
@@ -758,8 +757,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
if (!rq_mergeable(rq) || !bio_mergeable(bio))
return false;
- if (!blk_check_merge_flags(rq->cmd_flags, req_op(rq), bio->bi_rw,
- bio_op(bio)))
+ if (req_op(rq) != bio_op(bio))
return false;
/* different data direction or already started, don't merge */

block/blk-mq-tag.c

View file
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 56a0c37..729bac3 100644

This diff is incomplete. Download the complete patch.

block/blk-mq.c

View file

This diff is incomplete. Download the complete patch.

block/blk.h

View file

This diff is incomplete. Download the complete patch.

block/genhd.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/brd.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/cciss.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_actlog.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_bitmap.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_debugfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_int.h

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_interval.h

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_main.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_nl.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_proc.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_protocol.h

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_receiver.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_req.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_req.h

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_state.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_state.h

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_strings.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/drbd/drbd_worker.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/floppy.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/loop.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/mg_disk.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/mtip32xx/mtip32xx.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/null_blk.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/ps3disk.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/ps3vram.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/rsxx/dev.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/skd_main.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/sunvdc.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/umem.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/virtio_blk.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/xen-blkback/xenbus.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/xen-blkfront.c

View file

This diff is incomplete. Download the complete patch.

drivers/cdrom/cdrom.c

View file

This diff is incomplete. Download the complete patch.

drivers/ide/ide-cd.c

View file

This diff is incomplete. Download the complete patch.

drivers/ide/ide-gd.c

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/gennvm.c

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/gennvm.h

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/rrpc.c

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/rrpc.h

View file

This diff is incomplete. Download the complete patch.

drivers/lightnvm/sysblk.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/bcache/closure.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/bcache/closure.h

View file

This diff is incomplete. Download the complete patch.

drivers/md/bcache/io.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/bcache/super.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/dm-raid1.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/dm-snap.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/dm-zero.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/dm.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/raid1.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/raid10.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/raid5.c

View file

This diff is incomplete. Download the complete patch.

drivers/memstick/core/ms_block.c

View file

This diff is incomplete. Download the complete patch.

drivers/memstick/core/mspro_block.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/card/block.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/card/queue.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtd_blkdevs.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvdimm/blk.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvdimm/btt.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvdimm/bus.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvdimm/pmem.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/fabrics.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/fabrics.h

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/lightnvm.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/nvme.h

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/pci.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/host/rdma.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/admin-cmd.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/configfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/discovery.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/fabrics-cmd.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/io-cmd.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/loop.c

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/nvmet.h

View file

This diff is incomplete. Download the complete patch.

drivers/nvme/target/rdma.c

View file

This diff is incomplete. Download the complete patch.

drivers/s390/block/dasd_genhd.c

View file

This diff is incomplete. Download the complete patch.

drivers/s390/block/dcssblk.c

View file

This diff is incomplete. Download the complete patch.

drivers/s390/block/scm_blk.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/osd/osd_initiator.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/sd.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/sr.c

View file

This diff is incomplete. Download the complete patch.

drivers/target/target_core_pscsi.c

View file

This diff is incomplete. Download the complete patch.

fs/buffer.c

View file

This diff is incomplete. Download the complete patch.

fs/f2fs/checkpoint.c

View file

This diff is incomplete. Download the complete patch.

fs/f2fs/gc.c

View file

This diff is incomplete. Download the complete patch.

fs/f2fs/node.c

View file

This diff is incomplete. Download the complete patch.

fs/gfs2/bmap.c

View file

This diff is incomplete. Download the complete patch.

fs/gfs2/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/gfs2/meta_io.c

View file

This diff is incomplete. Download the complete patch.

fs/reiserfs/stree.c

View file

This diff is incomplete. Download the complete patch.

fs/udf/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/udf/directory.c

View file

This diff is incomplete. Download the complete patch.

include/linux/bio.h

View file

This diff is incomplete. Download the complete patch.

include/linux/blk-mq.h

View file

This diff is incomplete. Download the complete patch.

include/linux/blk_types.h

View file

This diff is incomplete. Download the complete patch.

include/linux/blkdev.h

View file

This diff is incomplete. Download the complete patch.

include/linux/drbd.h

View file

This diff is incomplete. Download the complete patch.

include/linux/drbd_genl.h

View file

This diff is incomplete. Download the complete patch.

include/linux/drbd_limits.h

View file

This diff is incomplete. Download the complete patch.

include/linux/fs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/genhd.h

View file

This diff is incomplete. Download the complete patch.

include/linux/lightnvm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/nvme-rdma.h

View file

This diff is incomplete. Download the complete patch.

include/linux/nvme.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/f2fs.h

View file

This diff is incomplete. Download the complete patch.

kernel/trace/blktrace.c

View file

This diff is incomplete. Download the complete patch.