Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759663AbbKTKzg (ORCPT ); Fri, 20 Nov 2015 05:55:36 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:36780 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759540AbbKTKze (ORCPT ); Fri, 20 Nov 2015 05:55:34 -0500 From: yalin wang To: axboe@fb.com, snitzer@redhat.com, tj@kernel.org, jack@suse.cz, shli@fb.com, ross.zwisler@linux.intel.com, matthew.r.wilcox@intel.com, rafael.j.wysocki@intel.com, yalin.wang2010@gmail.com, linux-kernel@vger.kernel.org Subject: [RFC] block: change blk_check_merge_flags() implementation Date: Fri, 20 Nov 2015 18:55:25 +0800 Message-Id: <1448016925-16092-1-git-send-email-yalin.wang2010@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1215 Lines: 38 Use XOR to chenk some flags in flags1 and flags2 if the same, much faster on some platforms. Signed-off-by: yalin wang --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/