From: Jeff Moyer <jmoyer@redhat.com> Date: Thu, 25 Mar 2010 16:53:11 -0400 Subject: [block] introduce the rq_is_sync macro Message-id: <1269535995-21213-2-git-send-email-jmoyer@redhat.com> Patchwork-id: 23757 O-Subject: [RHEL5 PATCH 1/5] block: introduce the rq_is_sync macro Bugzilla: 574285 RH-Acked-by: Josef Bacik <josef@redhat.com> RH-Acked-by: Vivek Goyal <vgoyal@redhat.com> RH-Acked-by: Jerome Marchand <jmarchan@redhat.com> This is a partial backport of the following upstream commit: commit 9e2585a8a23f3a42f815b2a638725d85a921cd65 Author: Jens Axboe <axboe@suse.de> Date: Fri Jul 28 09:26:13 2006 +0200 [PATCH] as-iosched: remove arq->is_sync member We can track this in struct request. Signed-off-by: Jens Axboe <axboe@suse.de> Signed-off-by: Nick Piggin <npiggin@suse.de> This patch simply introduces an rq_is_sync() macro. I chose not to backport the as-iosched bits as I wanted to limit the scope of the change. This is related to bug 574285. The rq_is_sync macro will be used by later patches to CFQ to differentiate between O_DIRECT and buffered writes. Signed-off-by: Jeff Moyer <jmoyer@redhat.com> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c005442..99b4017 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -540,6 +540,11 @@ static inline int blk_do_io_stat(struct request *rq) #define rq_data_dir(rq) ((rq)->flags & 1) +/* + * We regard a request as sync, if it's a READ or a SYNC write. + */ +#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->flags & REQ_RW_SYNC) + static inline int blk_queue_full(struct request_queue *q, int rw) { if (rw == READ)