mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
for-linus-20180425
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABCAAGBQJa4LCXAAoJEPfTWPspceCm4DkQAMT9oc4gVTooyRdjFkUwwYQp
oPQr8cNwp1ieB9n85sCVvo8AqP+hcRrp99/sNtMUfdTRcSAumHoILfJF8NcBHWW1
6t609oi73runWbKnMvv+cTNFjwkUT30HHlIZRG5Qtn4wsy6vZAQEiv7J0z7PWays
Lz7Hc1dfu2EbUoE4Phbe/wAqkQmw5HMGCCBltA9YhaApHTudR0i0bLyEN39zNyeF
GifGkqETJ847HD00x25Uko008K0Mg6C+bkBwXBXw/E0mzO+QBG14U1WcLCw7USP2
0KwaO1/F5SiaAUFBbW6TGCAYr/0M8JH9PRqAnGQ0sFlrnsh4gYrYEhnXtzMAbJb5
AfFZxGc12XzTHcrNF+Genx81NpVCCblgEPxkZky8FXUZS6p91X0kNZmtfsaFCl7e
3rc3reORz+9FaM481kY52Acw1J3gZZwdryXS040911yWRvtdS1dk80Q0FnL1qq44
WvoXawk78x59+tcGwyC57dPmTAaFMGHiFQvx4zM5EkoBqTSTtfHkHQMeyFk3Er6U
eSl+2Cp1FWiWZo4sJsmQtmhOshvBeIENyU4H3HaovsWFcOacFyLQSks2FSPquM4G
gUsg6yADbamotdiFpbALM97cEcN4se38WuMNbXsqk3gTBHsCML52m7f8IWpgU3ZW
hWuEU++093bAHADmhG81
=335E
-----END PGP SIGNATURE-----
Merge tag 'for-linus-20180425' of git://git.kernel.dk/linux-block
Pull block updates from Jens Axboe:
"I ended up sitting on this about a week longer than I wanted to, since
we were hashing out details with a timeout change. I've now killed
that patch, so we can flush the existing queue in due time.
This contains:
- Fix for an old regression, where entering the queue can be
disturbed by a signal to the process. This can cause spurious EIO.
Fix from Alan Jenkins.
- cdrom information leak fix from Dan.
- Trivial helper for testing queue FUA from Dave Chinner, part of his
O_DIRECT FUA series.
- Series of swim fixes from Finn that actually makes it work again.
- Loop O_DIRECT corruption fix, which caused data corruption in
production for us. From me.
- BFQ crash fix from me.
- bcache maintainer update. Michael no longer has the time to do it,
Coly has stepped up to serve as the new maintainer.
- blkcg locking fixes from Jiang Biao.
- Revert of a change from this merge window from Ming, that causes an
issue on some hardware.
- Minor clarification doc addition from Linus Walleij"
* tag 'for-linus-20180425' of git://git.kernel.dk/linux-block: (22 commits)
Revert "blk-mq: remove code for dealing with remapping queue"
block: mq: Add some minor doc for core structs
bcache: mark Coly Li as bcache maintainer
MAINTAINERS: Remove me as maintainer of bcache
blkcg: init root blkcg_gq under lock
blkcg: small fix on comment in blkcg_init_queue
blkcg: don't hold blkcg lock when deactivating policy
block: add blk_queue_fua() helper function
cdrom: information leak in cdrom_ioctl_media_changed()
bfq-iosched: ensure to clear bic/bfqq pointers when preparing request
blk-mq: start request gstate with gen 1
block/swim: Select appropriate drive on device open
block/swim: Fix IO error at end of medium
block/swim: Check drive type
block/swim: Rename macros to avoid inconsistent inverted logic
block/swim: Don't log an error message for an invalid ioctl
block/swim: Remove extra put_disk() call from error path
block/swim: Fix array bounds check
m68k/mac: Don't remap SWIM MMIO region
loop: handle short DIO reads
...
This commit is contained in:
commit
8fba70b085
13 changed files with 144 additions and 81 deletions
|
|
@ -451,25 +451,47 @@ static int lo_req_flush(struct loop_device *lo, struct request *rq)
|
|||
static void lo_complete_rq(struct request *rq)
|
||||
{
|
||||
struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq);
|
||||
blk_status_t ret = BLK_STS_OK;
|
||||
|
||||
if (unlikely(req_op(cmd->rq) == REQ_OP_READ && cmd->use_aio &&
|
||||
cmd->ret >= 0 && cmd->ret < blk_rq_bytes(cmd->rq))) {
|
||||
struct bio *bio = cmd->rq->bio;
|
||||
|
||||
bio_advance(bio, cmd->ret);
|
||||
zero_fill_bio(bio);
|
||||
if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) ||
|
||||
req_op(rq) != REQ_OP_READ) {
|
||||
if (cmd->ret < 0)
|
||||
ret = BLK_STS_IOERR;
|
||||
goto end_io;
|
||||
}
|
||||
|
||||
blk_mq_end_request(rq, cmd->ret < 0 ? BLK_STS_IOERR : BLK_STS_OK);
|
||||
/*
|
||||
* Short READ - if we got some data, advance our request and
|
||||
* retry it. If we got no data, end the rest with EIO.
|
||||
*/
|
||||
if (cmd->ret) {
|
||||
blk_update_request(rq, BLK_STS_OK, cmd->ret);
|
||||
cmd->ret = 0;
|
||||
blk_mq_requeue_request(rq, true);
|
||||
} else {
|
||||
if (cmd->use_aio) {
|
||||
struct bio *bio = rq->bio;
|
||||
|
||||
while (bio) {
|
||||
zero_fill_bio(bio);
|
||||
bio = bio->bi_next;
|
||||
}
|
||||
}
|
||||
ret = BLK_STS_IOERR;
|
||||
end_io:
|
||||
blk_mq_end_request(rq, ret);
|
||||
}
|
||||
}
|
||||
|
||||
static void lo_rw_aio_do_completion(struct loop_cmd *cmd)
|
||||
{
|
||||
struct request *rq = blk_mq_rq_from_pdu(cmd);
|
||||
|
||||
if (!atomic_dec_and_test(&cmd->ref))
|
||||
return;
|
||||
kfree(cmd->bvec);
|
||||
cmd->bvec = NULL;
|
||||
blk_mq_complete_request(cmd->rq);
|
||||
blk_mq_complete_request(rq);
|
||||
}
|
||||
|
||||
static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2)
|
||||
|
|
@ -487,7 +509,7 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
|
|||
{
|
||||
struct iov_iter iter;
|
||||
struct bio_vec *bvec;
|
||||
struct request *rq = cmd->rq;
|
||||
struct request *rq = blk_mq_rq_from_pdu(cmd);
|
||||
struct bio *bio = rq->bio;
|
||||
struct file *file = lo->lo_backing_file;
|
||||
unsigned int offset;
|
||||
|
|
@ -1702,15 +1724,16 @@ EXPORT_SYMBOL(loop_unregister_transfer);
|
|||
static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx,
|
||||
const struct blk_mq_queue_data *bd)
|
||||
{
|
||||
struct loop_cmd *cmd = blk_mq_rq_to_pdu(bd->rq);
|
||||
struct loop_device *lo = cmd->rq->q->queuedata;
|
||||
struct request *rq = bd->rq;
|
||||
struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq);
|
||||
struct loop_device *lo = rq->q->queuedata;
|
||||
|
||||
blk_mq_start_request(bd->rq);
|
||||
blk_mq_start_request(rq);
|
||||
|
||||
if (lo->lo_state != Lo_bound)
|
||||
return BLK_STS_IOERR;
|
||||
|
||||
switch (req_op(cmd->rq)) {
|
||||
switch (req_op(rq)) {
|
||||
case REQ_OP_FLUSH:
|
||||
case REQ_OP_DISCARD:
|
||||
case REQ_OP_WRITE_ZEROES:
|
||||
|
|
@ -1723,8 +1746,8 @@ static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|||
|
||||
/* always use the first bio's css */
|
||||
#ifdef CONFIG_BLK_CGROUP
|
||||
if (cmd->use_aio && cmd->rq->bio && cmd->rq->bio->bi_css) {
|
||||
cmd->css = cmd->rq->bio->bi_css;
|
||||
if (cmd->use_aio && rq->bio && rq->bio->bi_css) {
|
||||
cmd->css = rq->bio->bi_css;
|
||||
css_get(cmd->css);
|
||||
} else
|
||||
#endif
|
||||
|
|
@ -1736,8 +1759,9 @@ static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|||
|
||||
static void loop_handle_cmd(struct loop_cmd *cmd)
|
||||
{
|
||||
const bool write = op_is_write(req_op(cmd->rq));
|
||||
struct loop_device *lo = cmd->rq->q->queuedata;
|
||||
struct request *rq = blk_mq_rq_from_pdu(cmd);
|
||||
const bool write = op_is_write(req_op(rq));
|
||||
struct loop_device *lo = rq->q->queuedata;
|
||||
int ret = 0;
|
||||
|
||||
if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) {
|
||||
|
|
@ -1745,12 +1769,12 @@ static void loop_handle_cmd(struct loop_cmd *cmd)
|
|||
goto failed;
|
||||
}
|
||||
|
||||
ret = do_req_filebacked(lo, cmd->rq);
|
||||
ret = do_req_filebacked(lo, rq);
|
||||
failed:
|
||||
/* complete non-aio request */
|
||||
if (!cmd->use_aio || ret) {
|
||||
cmd->ret = ret ? -EIO : 0;
|
||||
blk_mq_complete_request(cmd->rq);
|
||||
blk_mq_complete_request(rq);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1767,9 +1791,7 @@ static int loop_init_request(struct blk_mq_tag_set *set, struct request *rq,
|
|||
{
|
||||
struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq);
|
||||
|
||||
cmd->rq = rq;
|
||||
kthread_init_work(&cmd->work, loop_queue_work);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ struct loop_device {
|
|||
|
||||
struct loop_cmd {
|
||||
struct kthread_work work;
|
||||
struct request *rq;
|
||||
bool use_aio; /* use AIO interface to handle I/O */
|
||||
atomic_t ref; /* only for aio */
|
||||
long ret;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ struct iwm {
|
|||
/* Select values for swim_select and swim_readbit */
|
||||
|
||||
#define READ_DATA_0 0x074
|
||||
#define TWOMEG_DRIVE 0x075
|
||||
#define ONEMEG_DRIVE 0x075
|
||||
#define SINGLE_SIDED 0x076
|
||||
#define DRIVE_PRESENT 0x077
|
||||
#define DISK_IN 0x170
|
||||
|
|
@ -118,9 +118,9 @@ struct iwm {
|
|||
#define TRACK_ZERO 0x172
|
||||
#define TACHO 0x173
|
||||
#define READ_DATA_1 0x174
|
||||
#define MFM_MODE 0x175
|
||||
#define GCR_MODE 0x175
|
||||
#define SEEK_COMPLETE 0x176
|
||||
#define ONEMEG_MEDIA 0x177
|
||||
#define TWOMEG_MEDIA 0x177
|
||||
|
||||
/* Bits in handshake register */
|
||||
|
||||
|
|
@ -612,7 +612,6 @@ static void setup_medium(struct floppy_state *fs)
|
|||
struct floppy_struct *g;
|
||||
fs->disk_in = 1;
|
||||
fs->write_protected = swim_readbit(base, WRITE_PROT);
|
||||
fs->type = swim_readbit(base, ONEMEG_MEDIA);
|
||||
|
||||
if (swim_track00(base))
|
||||
printk(KERN_ERR
|
||||
|
|
@ -620,6 +619,9 @@ static void setup_medium(struct floppy_state *fs)
|
|||
|
||||
swim_track00(base);
|
||||
|
||||
fs->type = swim_readbit(base, TWOMEG_MEDIA) ?
|
||||
HD_MEDIA : DD_MEDIA;
|
||||
fs->head_number = swim_readbit(base, SINGLE_SIDED) ? 1 : 2;
|
||||
get_floppy_geometry(fs, 0, &g);
|
||||
fs->total_secs = g->size;
|
||||
fs->secpercyl = g->head * g->sect;
|
||||
|
|
@ -646,7 +648,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
|
|||
|
||||
swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2);
|
||||
udelay(10);
|
||||
swim_drive(base, INTERNAL_DRIVE);
|
||||
swim_drive(base, fs->location);
|
||||
swim_motor(base, ON);
|
||||
swim_action(base, SETMFM);
|
||||
if (fs->ejected)
|
||||
|
|
@ -656,6 +658,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
|
|||
goto out;
|
||||
}
|
||||
|
||||
set_capacity(fs->disk, fs->total_secs);
|
||||
|
||||
if (mode & FMODE_NDELAY)
|
||||
return 0;
|
||||
|
||||
|
|
@ -727,14 +731,9 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
|
|||
if (copy_to_user((void __user *) param, (void *) &floppy_type,
|
||||
sizeof(struct floppy_struct)))
|
||||
return -EFAULT;
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_DEBUG "SWIM floppy_ioctl: unknown cmd %d\n",
|
||||
cmd);
|
||||
return -ENOSYS;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
|
|
@ -795,7 +794,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
|
|||
struct swim_priv *swd = data;
|
||||
int drive = (*part & 3);
|
||||
|
||||
if (drive > swd->floppy_count)
|
||||
if (drive >= swd->floppy_count)
|
||||
return NULL;
|
||||
|
||||
*part = 0;
|
||||
|
|
@ -813,10 +812,9 @@ static int swim_add_floppy(struct swim_priv *swd, enum drive_location location)
|
|||
|
||||
swim_motor(base, OFF);
|
||||
|
||||
if (swim_readbit(base, SINGLE_SIDED))
|
||||
fs->head_number = 1;
|
||||
else
|
||||
fs->head_number = 2;
|
||||
fs->type = HD_MEDIA;
|
||||
fs->head_number = 2;
|
||||
|
||||
fs->ref_count = 0;
|
||||
fs->ejected = 1;
|
||||
|
||||
|
|
@ -834,10 +832,12 @@ static int swim_floppy_init(struct swim_priv *swd)
|
|||
/* scan floppy drives */
|
||||
|
||||
swim_drive(base, INTERNAL_DRIVE);
|
||||
if (swim_readbit(base, DRIVE_PRESENT))
|
||||
if (swim_readbit(base, DRIVE_PRESENT) &&
|
||||
!swim_readbit(base, ONEMEG_DRIVE))
|
||||
swim_add_floppy(swd, INTERNAL_DRIVE);
|
||||
swim_drive(base, EXTERNAL_DRIVE);
|
||||
if (swim_readbit(base, DRIVE_PRESENT))
|
||||
if (swim_readbit(base, DRIVE_PRESENT) &&
|
||||
!swim_readbit(base, ONEMEG_DRIVE))
|
||||
swim_add_floppy(swd, EXTERNAL_DRIVE);
|
||||
|
||||
/* register floppy drives */
|
||||
|
|
@ -861,7 +861,6 @@ static int swim_floppy_init(struct swim_priv *swd)
|
|||
&swd->lock);
|
||||
if (!swd->unit[drive].disk->queue) {
|
||||
err = -ENOMEM;
|
||||
put_disk(swd->unit[drive].disk);
|
||||
goto exit_put_disks;
|
||||
}
|
||||
blk_queue_bounce_limit(swd->unit[drive].disk->queue,
|
||||
|
|
@ -911,7 +910,7 @@ static int swim_probe(struct platform_device *dev)
|
|||
goto out;
|
||||
}
|
||||
|
||||
swim_base = ioremap(res->start, resource_size(res));
|
||||
swim_base = (struct swim __iomem *)res->start;
|
||||
if (!swim_base) {
|
||||
ret = -ENOMEM;
|
||||
goto out_release_io;
|
||||
|
|
@ -923,7 +922,7 @@ static int swim_probe(struct platform_device *dev)
|
|||
if (!get_swim_mode(swim_base)) {
|
||||
printk(KERN_INFO "SWIM device not found !\n");
|
||||
ret = -ENODEV;
|
||||
goto out_iounmap;
|
||||
goto out_release_io;
|
||||
}
|
||||
|
||||
/* set platform driver data */
|
||||
|
|
@ -931,7 +930,7 @@ static int swim_probe(struct platform_device *dev)
|
|||
swd = kzalloc(sizeof(struct swim_priv), GFP_KERNEL);
|
||||
if (!swd) {
|
||||
ret = -ENOMEM;
|
||||
goto out_iounmap;
|
||||
goto out_release_io;
|
||||
}
|
||||
platform_set_drvdata(dev, swd);
|
||||
|
||||
|
|
@ -945,8 +944,6 @@ static int swim_probe(struct platform_device *dev)
|
|||
|
||||
out_kfree:
|
||||
kfree(swd);
|
||||
out_iounmap:
|
||||
iounmap(swim_base);
|
||||
out_release_io:
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
out:
|
||||
|
|
@ -974,8 +971,6 @@ static int swim_remove(struct platform_device *dev)
|
|||
for (drive = 0; drive < swd->floppy_count; drive++)
|
||||
floppy_eject(&swd->unit[drive]);
|
||||
|
||||
iounmap(swd->base);
|
||||
|
||||
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
||||
if (res)
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ struct swim3 {
|
|||
#define MOTOR_ON 2
|
||||
#define RELAX 3 /* also eject in progress */
|
||||
#define READ_DATA_0 4
|
||||
#define TWOMEG_DRIVE 5
|
||||
#define ONEMEG_DRIVE 5
|
||||
#define SINGLE_SIDED 6 /* drive or diskette is 4MB type? */
|
||||
#define DRIVE_PRESENT 7
|
||||
#define DISK_IN 8
|
||||
|
|
@ -156,9 +156,9 @@ struct swim3 {
|
|||
#define TRACK_ZERO 10
|
||||
#define TACHO 11
|
||||
#define READ_DATA_1 12
|
||||
#define MFM_MODE 13
|
||||
#define GCR_MODE 13
|
||||
#define SEEK_COMPLETE 14
|
||||
#define ONEMEG_MEDIA 15
|
||||
#define TWOMEG_MEDIA 15
|
||||
|
||||
/* Definitions of values used in writing and formatting */
|
||||
#define DATA_ESCAPE 0x99
|
||||
|
|
|
|||
Loading…
Reference in a new issue