block: make blk_do_io_stat() do the full "is this rq accountable" checks
We currently check for file system requests outside of blk_do_io_stat(rq), but we may as well just include it. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
@@ -68,7 +68,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
|
|||||||
int rw = rq_data_dir(rq);
|
int rw = rq_data_dir(rq);
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
if (!blk_fs_request(rq) || !blk_do_io_stat(rq))
|
if (!blk_do_io_stat(rq))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cpu = part_stat_lock();
|
cpu = part_stat_lock();
|
||||||
@@ -1639,10 +1639,7 @@ EXPORT_SYMBOL(blkdev_dequeue_request);
|
|||||||
|
|
||||||
static void blk_account_io_completion(struct request *req, unsigned int bytes)
|
static void blk_account_io_completion(struct request *req, unsigned int bytes)
|
||||||
{
|
{
|
||||||
if (!blk_do_io_stat(req))
|
if (blk_do_io_stat(req)) {
|
||||||
return;
|
|
||||||
|
|
||||||
if (blk_fs_request(req)) {
|
|
||||||
const int rw = rq_data_dir(req);
|
const int rw = rq_data_dir(req);
|
||||||
struct hd_struct *part;
|
struct hd_struct *part;
|
||||||
int cpu;
|
int cpu;
|
||||||
@@ -1656,15 +1653,12 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
|
|||||||
|
|
||||||
static void blk_account_io_done(struct request *req)
|
static void blk_account_io_done(struct request *req)
|
||||||
{
|
{
|
||||||
if (!blk_do_io_stat(req))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Account IO completion. bar_rq isn't accounted as a normal
|
* Account IO completion. bar_rq isn't accounted as a normal
|
||||||
* IO on queueing nor completion. Accounting the containing
|
* IO on queueing nor completion. Accounting the containing
|
||||||
* request is enough.
|
* request is enough.
|
||||||
*/
|
*/
|
||||||
if (blk_fs_request(req) && req != &req->q->bar_rq) {
|
if (blk_do_io_stat(req) && req != &req->q->bar_rq) {
|
||||||
unsigned long duration = jiffies - req->start_time;
|
unsigned long duration = jiffies - req->start_time;
|
||||||
const int rw = rq_data_dir(req);
|
const int rw = rq_data_dir(req);
|
||||||
struct hd_struct *part;
|
struct hd_struct *part;
|
||||||
|
@@ -149,9 +149,16 @@ static inline int blk_cpu_to_group(int cpu)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Contribute to IO statistics IFF:
|
||||||
|
*
|
||||||
|
* a) it's attached to a gendisk, and
|
||||||
|
* b) the queue had IO stats enabled when this request was started, and
|
||||||
|
* c) it's a file system request
|
||||||
|
*/
|
||||||
static inline int blk_do_io_stat(struct request *rq)
|
static inline int blk_do_io_stat(struct request *rq)
|
||||||
{
|
{
|
||||||
return rq->rq_disk && blk_rq_io_stat(rq);
|
return rq->rq_disk && blk_rq_io_stat(rq) && blk_fs_request(rq);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user