Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f06d9a2b authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

block: replace end_request() with [__]blk_end_request_cur()



end_request() has been kept around for backward compatibility;
however, it's about time for it to go away.

* There aren't too many users left.

* Its use of @updtodate is pretty confusing.

* In some cases, newer code ends up using mixture of end_request() and
  [__]blk_end_request[_all](), which is way too confusing.

So, add [__]blk_end_request_cur() and replace end_request() with it.
Most conversions are straightforward.  Noteworthy ones are...

* paride/pcd: next_request() updated to take 0/-errno instead of 1/0.

* paride/pf: pf_end_request() and next_request() updated to take
  0/-errno instead of 1/0.

* xd: xd_readwrite() updated to return 0/-errno instead of 1/0.

* mtd/mtd_blkdevs: blktrans_discard_request() updated to return
  0/-errno instead of 1/0.  Unnecessary local variable res
  initialization removed from mtd_blktrans_thread().

[ Impact: cleanup ]

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarJoerg Dorchain <joerg@dorchain.net>
Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Acked-by: default avatarLaurent Vivier <Laurent@lvivier.info>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: unsik Kim <donari75@gmail.com>
parent 40cbbb78
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1359,7 +1359,7 @@ static void redo_fd_request(void)
#endif
		block = CURRENT->sector + cnt;
		if ((int)block > floppy->blocks) {
			end_request(CURRENT, 0);
			__blk_end_request_cur(CURRENT, -EIO);
			goto repeat;
		}

@@ -1373,11 +1373,11 @@ static void redo_fd_request(void)

		if ((rq_data_dir(CURRENT) != READ) && (rq_data_dir(CURRENT) != WRITE)) {
			printk(KERN_WARNING "do_fd_request: unknown command\n");
			end_request(CURRENT, 0);
			__blk_end_request_cur(CURRENT, -EIO);
			goto repeat;
		}
		if (get_track(drive, track) == -1) {
			end_request(CURRENT, 0);
			__blk_end_request_cur(CURRENT, -EIO);
			goto repeat;
		}

@@ -1391,7 +1391,7 @@ static void redo_fd_request(void)

			/* keep the drive spinning while writes are scheduled */
			if (!fd_motor_on(drive)) {
				end_request(CURRENT, 0);
				__blk_end_request_cur(CURRENT, -EIO);
				goto repeat;
			}
			/*
@@ -1410,7 +1410,7 @@ static void redo_fd_request(void)
	CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
	CURRENT->sector += CURRENT->current_nr_sectors;

	end_request(CURRENT, 1);
	__blk_end_request_cur(CURRENT, 0);
	goto repeat;
}

+7 −7
Original line number Diff line number Diff line
@@ -612,7 +612,7 @@ static void fd_error( void )
	CURRENT->errors++;
	if (CURRENT->errors >= MAX_ERRORS) {
		printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
		end_request(CURRENT, 0);
		__blk_end_request_cur(CURRENT, -EIO);
	}
	else if (CURRENT->errors == RECALIBRATE_ERRORS) {
		printk(KERN_WARNING "fd%d: recalibrating\n", SelectedDrive );
@@ -734,7 +734,7 @@ static void do_fd_action( int drive )
			/* all sectors finished */
			CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
			CURRENT->sector += CURRENT->current_nr_sectors;
			end_request(CURRENT, 1);
			__blk_end_request_cur(CURRENT, 0);
			redo_fd_request();
			return;
		    }
@@ -1141,7 +1141,7 @@ static void fd_rwsec_done1(int status)
		/* all sectors finished */
		CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
		CURRENT->sector += CURRENT->current_nr_sectors;
		end_request(CURRENT, 1);
		__blk_end_request_cur(CURRENT, 0);
		redo_fd_request();
	}
	return;
@@ -1414,7 +1414,7 @@ static void redo_fd_request(void)
	if (!UD.connected) {
		/* drive not connected */
		printk(KERN_ERR "Unknown Device: fd%d\n", drive );
		end_request(CURRENT, 0);
		__blk_end_request_cur(CURRENT, -EIO);
		goto repeat;
	}
		
@@ -1430,12 +1430,12 @@ static void redo_fd_request(void)
		/* user supplied disk type */
		if (--type >= NUM_DISK_MINORS) {
			printk(KERN_WARNING "fd%d: invalid disk format", drive );
			end_request(CURRENT, 0);
			__blk_end_request_cur(CURRENT, -EIO);
			goto repeat;
		}
		if (minor2disktype[type].drive_types > DriveType)  {
			printk(KERN_WARNING "fd%d: unsupported disk format", drive );
			end_request(CURRENT, 0);
			__blk_end_request_cur(CURRENT, -EIO);
			goto repeat;
		}
		type = minor2disktype[type].index;
@@ -1445,7 +1445,7 @@ static void redo_fd_request(void)
	}
	
	if (CURRENT->sector + 1 > UDT->blocks) {
		end_request(CURRENT, 0);
		__blk_end_request_cur(CURRENT, -EIO);
		goto repeat;
	}

+7 −7
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ static void bad_rw_intr(void)
	if (req != NULL) {
		struct hd_i_struct *disk = req->rq_disk->private_data;
		if (++req->errors >= MAX_ERRORS || (hd_error & BBD_ERR)) {
			end_request(req, 0);
			__blk_end_request_cur(req, -EIO);
			disk->special_op = disk->recalibrate = 1;
		} else if (req->errors % RESET_FREQ == 0)
			reset = 1;
@@ -466,7 +466,7 @@ static void read_intr(void)
		req->buffer+512);
#endif
	if (req->current_nr_sectors <= 0)
		end_request(req, 1);
		__blk_end_request_cur(req, 0);
	if (i > 0) {
		SET_HANDLER(&read_intr);
		return;
@@ -505,7 +505,7 @@ static void write_intr(void)
	--req->current_nr_sectors;
	req->buffer += 512;
	if (!i || (req->bio && req->current_nr_sectors <= 0))
		end_request(req, 1);
		__blk_end_request_cur(req, 0);
	if (i > 0) {
		SET_HANDLER(&write_intr);
		outsw(HD_DATA, req->buffer, 256);
@@ -548,7 +548,7 @@ static void hd_times_out(unsigned long dummy)
#ifdef DEBUG
		printk("%s: too many errors\n", name);
#endif
		end_request(CURRENT, 0);
		__blk_end_request_cur(CURRENT, -EIO);
	}
	hd_request();
	spin_unlock_irq(hd_queue->queue_lock);
@@ -563,7 +563,7 @@ static int do_special_op(struct hd_i_struct *disk, struct request *req)
	}
	if (disk->head > 16) {
		printk("%s: cannot handle device with more than 16 heads - giving up\n", req->rq_disk->disk_name);
		end_request(req, 0);
		__blk_end_request_cur(req, -EIO);
	}
	disk->special_op = 0;
	return 1;
@@ -607,7 +607,7 @@ static void hd_request(void)
	    ((block+nsect) > get_capacity(req->rq_disk))) {
		printk("%s: bad access: block=%d, count=%d\n",
			req->rq_disk->disk_name, block, nsect);
		end_request(req, 0);
		__blk_end_request_cur(req, -EIO);
		goto repeat;
	}

@@ -647,7 +647,7 @@ static void hd_request(void)
			break;
		default:
			printk("unknown hd-command\n");
			end_request(req, 0);
			__blk_end_request_cur(req, -EIO);
			break;
		}
	}
+8 −8
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ static void mg_bad_rw_intr(struct mg_host *host)
	if (req != NULL)
		if (++req->errors >= MG_MAX_ERRORS ||
				host->error == MG_ERR_TIMEOUT)
			end_request(req, 0);
			__blk_end_request_cur(req, -EIO);
}

static unsigned int mg_out(struct mg_host *host,
@@ -351,7 +351,7 @@ static void mg_read(struct request *req)

		if (req->current_nr_sectors <= 0) {
			MG_DBG("remain : %d sects\n", remains);
			end_request(req, 1);
			__blk_end_request_cur(req, 0);
			if (remains > 0)
				req = elv_next_request(host->breq);
		}
@@ -395,7 +395,7 @@ static void mg_write(struct request *req)

		if (req->current_nr_sectors <= 0) {
			MG_DBG("remain : %d sects\n", remains);
			end_request(req, 1);
			__blk_end_request_cur(req, 0);
			if (remains > 0)
				req = elv_next_request(host->breq);
		}
@@ -448,7 +448,7 @@ static void mg_read_intr(struct mg_host *host)

	/* let know if current segment done */
	if (req->current_nr_sectors <= 0)
		end_request(req, 1);
		__blk_end_request_cur(req, 0);

	/* set handler if read remains */
	if (i > 0) {
@@ -497,7 +497,7 @@ static void mg_write_intr(struct mg_host *host)

	/* let know if current segment or all done */
	if (!i || (req->bio && req->current_nr_sectors <= 0))
		end_request(req, 1);
		__blk_end_request_cur(req, 0);

	/* write 1 sector and set handler if remains */
	if (i > 0) {
@@ -563,7 +563,7 @@ static void mg_request_poll(struct request_queue *q)
			default:
				printk(KERN_WARNING "%s:%d unknown command\n",
						__func__, __LINE__);
				end_request(req, 0);
				__blk_end_request_cur(req, -EIO);
				break;
			}
		}
@@ -617,7 +617,7 @@ static unsigned int mg_issue_req(struct request *req,
	default:
		printk(KERN_WARNING "%s:%d unknown command\n",
				__func__, __LINE__);
		end_request(req, 0);
		__blk_end_request_cur(req, -EIO);
		break;
	}
	return MG_ERR_NONE;
@@ -655,7 +655,7 @@ static void mg_request(struct request_queue *q)
					"%s: bad access: sector=%d, count=%d\n",
					req->rq_disk->disk_name,
					sect_num, sect_cnt);
			end_request(req, 0);
			__blk_end_request_cur(req, -EIO);
			continue;
		}

+6 −6
Original line number Diff line number Diff line
@@ -735,16 +735,16 @@ static void do_pcd_request(struct request_queue * q)
			ps_set_intr(do_pcd_read, NULL, 0, nice);
			return;
		} else
			end_request(pcd_req, 0);
			__blk_end_request_cur(pcd_req, -EIO);
	}
}

static inline void next_request(int success)
static inline void next_request(int err)
{
	unsigned long saved_flags;

	spin_lock_irqsave(&pcd_lock, saved_flags);
	end_request(pcd_req, success);
	__blk_end_request_cur(pcd_req, err);
	pcd_busy = 0;
	do_pcd_request(pcd_queue);
	spin_unlock_irqrestore(&pcd_lock, saved_flags);
@@ -781,7 +781,7 @@ static void pcd_start(void)

	if (pcd_command(pcd_current, rd_cmd, 2048, "read block")) {
		pcd_bufblk = -1;
		next_request(0);
		next_request(-EIO);
		return;
	}

@@ -796,7 +796,7 @@ static void do_pcd_read(void)
	pcd_retries = 0;
	pcd_transfer();
	if (!pcd_count) {
		next_request(1);
		next_request(0);
		return;
	}

@@ -815,7 +815,7 @@ static void do_pcd_read_drq(void)
			return;
		}
		pcd_bufblk = -1;
		next_request(0);
		next_request(-EIO);
		return;
	}

Loading