Re: [PATCH] Fix discard requests accounting in the diskstats

From: Andrew Morton
Date: Thu Apr 23 2009 - 15:59:12 EST


On Fri, 17 Apr 2009 11:44:49 +0530
Nikanth Karthikesan <knikanth@xxxxxxx> wrote:

> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -667,7 +667,9 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
> (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
> #define rq_mergeable(rq) \
> (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
> - (blk_discard_rq(rq) || blk_fs_request((rq))))
> + (blk_discard_rq(rq) || blk_fs_request(rq)))
> +#define rq_accountable(rq) \
> + (blk_discard_rq(rq) || blk_fs_request(rq))

Both these macros reference their argument multiple times and are
potentially buggy and/or inefficient if passed an expression with
side-effects.

There was (afaict) no reason for them to have been implemented as
macros.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/