block: introduce new block status code type
authorChristoph Hellwig <hch@lst.de>
Sat, 3 Jun 2017 07:38:04 +0000 (09:38 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 9 Jun 2017 15:27:32 +0000 (09:27 -0600)
commit2a842acab109f40f0d7d10b38e9ca88390628996
treebdfc7a47fe655c2ea7a5f74127015d7a502042f0
parent1be5690984588953e759af0a4c6ddac182a1806c
block: introduce new block status code type

Currently we use nornal Linux errno values in the block layer, and while
we accept any error a few have overloaded magic meanings.  This patch
instead introduces a new  blk_status_t value that holds block layer specific
status codes and explicitly explains their meaning.  Helpers to convert from
and to the previous special meanings are provided for now, but I suspect
we want to get rid of them in the long run - those drivers that have a
errno input (e.g. networking) usually get errnos that don't know about
the special block layer overloads, and similarly returning them to userspace
will usually return somethings that strictly speaking isn't correct
for file system operations, but that's left as an exercise for later.

For now the set of errors is a very limited set that closely corresponds
to the previous overloaded errno values, but there is some low hanging
fruite to improve it.

blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse
typechecking, so that we can easily catch places passing the wrong values.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
76 files changed:
arch/s390/include/asm/eadm.h
arch/um/drivers/ubd_kern.c
block/blk-core.c
block/blk-exec.c
block/blk-flush.c
block/blk-mq.c
block/bsg-lib.c
block/bsg.c
drivers/block/DAC960.c
drivers/block/amiflop.c
drivers/block/aoe/aoecmd.c
drivers/block/ataflop.c
drivers/block/cciss.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/mtip32xx/mtip32xx.c
drivers/block/mtip32xx/mtip32xx.h
drivers/block/nbd.c
drivers/block/null_blk.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/ps3disk.c
drivers/block/rbd.c
drivers/block/skd_main.c
drivers/block/sunvdc.c
drivers/block/swim.c
drivers/block/swim3.c
drivers/block/sx8.c
drivers/block/virtio_blk.c
drivers/block/xen-blkfront.c
drivers/block/xsysace.c
drivers/block/z2ram.c
drivers/cdrom/gdrom.c
drivers/ide/ide-atapi.c
drivers/ide/ide-cd.c
drivers/ide/ide-dma.c
drivers/ide/ide-eh.c
drivers/ide/ide-floppy.c
drivers/ide/ide-io.c
drivers/ide/ide-pm.c
drivers/ide/ide-tape.c
drivers/ide/ide-taskfile.c
drivers/ide/siimage.c
drivers/md/dm-mpath.c
drivers/md/dm-rq.c
drivers/md/dm-rq.h
drivers/memstick/core/ms_block.c
drivers/memstick/core/mspro_block.c
drivers/mmc/core/block.c
drivers/mmc/core/queue.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/ubi/block.c
drivers/nvme/host/core.c
drivers/nvme/host/lightnvm.c
drivers/nvme/host/pci.c
drivers/s390/block/dasd.c
drivers/s390/block/scm_blk.c
drivers/s390/block/scm_blk.h
drivers/s390/cio/eadm_sch.c
drivers/s390/cio/scm.c
drivers/sbus/char/jsflash.c
drivers/scsi/osd/osd_initiator.c
drivers/scsi/osst.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_transport_sas.c
drivers/scsi/sg.c
drivers/scsi/st.c
drivers/target/target_core_pscsi.c
include/linux/blk-mq.h
include/linux/blk_types.h
include/linux/blkdev.h
include/linux/device-mapper.h
include/linux/ide.h
include/scsi/osd_initiator.h