mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] block: change blk_check_merge_flags() implementation
@ 2015-11-20 10:55 yalin wang
  0 siblings, 0 replies; only message in thread
From: yalin wang @ 2015-11-20 10:55 UTC (permalink / raw)
  To: axboe, snitzer, tj, jack, shli, ross.zwisler, matthew.r.wilcox,
	rafael.j.wysocki, yalin.wang2010, linux-kernel

Use XOR to chenk some flags in flags1 and flags2 if the same,
much faster on some platforms.

Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
 include/linux/blkdev.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c401ecd..3d0f053 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -655,16 +655,7 @@ static inline bool rq_mergeable(struct request *rq)
 static inline bool blk_check_merge_flags(unsigned int flags1,
 					 unsigned int flags2)
 {
-	if ((flags1 & REQ_DISCARD) != (flags2 & REQ_DISCARD))
-		return false;
-
-	if ((flags1 & REQ_SECURE) != (flags2 & REQ_SECURE))
-		return false;
-
-	if ((flags1 & REQ_WRITE_SAME) != (flags2 & REQ_WRITE_SAME))
-		return false;
-
-	return true;
+	return !((flags1 ^ flags2) & (REQ_DISCARD | REQ_SECURE | REQ_WRITE_SAME));
 }
 
 static inline bool blk_write_same_mergeable(struct bio *a, struct bio *b)
-- 
1.9.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-20 10:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 10:55 [RFC] block: change blk_check_merge_flags() implementation yalin wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®