From patchwork Tue Mar 22 17:55:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 8644451 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4AC9EC0553 for ; Tue, 22 Mar 2016 17:57:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 508D520115 for ; Tue, 22 Mar 2016 17:57:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4302D2012D for ; Tue, 22 Mar 2016 17:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757104AbcCVRze (ORCPT ); Tue, 22 Mar 2016 13:55:34 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:22560 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755277AbcCVRzc (ORCPT ); Tue, 22 Mar 2016 13:55:32 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u2MHsP5E022957; Tue, 22 Mar 2016 10:55:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=IaqTnCtT++ZDR4i6aPe/rURqdG55xCW+C7k/F+K51uo=; b=D1WPL0pljEELYoL+WZ2Hj/0qcsAoyWSyEWx7ftbdgv7cpS49EEn6fhLG2uDUkqmO8Ky9 SZrZNgzTO7lCaEMuK1AqEUivv4cOx5YL7H7JCMC2C/k+WKq04gbCfHReSIlFTCeWfZ7m /1NXPyTbGqdiI93GmJAE21/aXEyfGXcJdco= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 21s2k8xum2-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT); Tue, 22 Mar 2016 10:55:30 -0700 Received: from localhost.localdomain (192.168.54.13) by mail.thefacebook.com (192.168.16.21) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 22 Mar 2016 10:55:29 -0700 From: Jens Axboe To: , , CC: Jens Axboe Subject: [PATCH 1/6] block: ensure we don't truncate top bits of the request command flags Date: Tue, 22 Mar 2016 11:55:15 -0600 Message-ID: <1458669320-6819-2-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.4.1.168.g1ea28e1 In-Reply-To: <1458669320-6819-1-git-send-email-axboe@fb.com> References: <1458669320-6819-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-03-22_09:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some of the flags that we want to use from the make_request_fn path are now larger than 32-bit, so change the functions involved to accept an u64 instead of an unsigned int. Signed-off-by: Jens Axboe --- block/blk-core.c | 7 ++++--- block/cfq-iosched.c | 2 +- block/elevator.c | 6 +++--- include/linux/blkdev.h | 2 +- include/linux/elevator.h | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 827f8badd143..a9fe3d88af99 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1065,7 +1065,7 @@ static struct io_context *rq_ioc(struct bio *bio) * Returns ERR_PTR on failure, with @q->queue_lock held. * Returns request pointer on success, with @q->queue_lock *not held*. */ -static struct request *__get_request(struct request_list *rl, int rw_flags, +static struct request *__get_request(struct request_list *rl, u64 rw_flags, struct bio *bio, gfp_t gfp_mask) { struct request_queue *q = rl->q; @@ -1237,7 +1237,7 @@ rq_starved: * Returns ERR_PTR on failure, with @q->queue_lock held. * Returns request pointer on success, with @q->queue_lock *not held*. */ -static struct request *get_request(struct request_queue *q, int rw_flags, +static struct request *get_request(struct request_queue *q, u64 rw_flags, struct bio *bio, gfp_t gfp_mask) { const bool is_sync = rw_is_sync(rw_flags) != 0; @@ -1711,9 +1711,10 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) { const bool sync = !!(bio->bi_rw & REQ_SYNC); struct blk_plug *plug; - int el_ret, rw_flags, where = ELEVATOR_INSERT_SORT; + int el_ret, where = ELEVATOR_INSERT_SORT; struct request *req; unsigned int request_count = 0; + u64 rw_flags; /* * low level driver can indicate that it wants pages above a diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index e3c591dd8f19..3e3b47b6a72f 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -4285,7 +4285,7 @@ static inline int __cfq_may_queue(struct cfq_queue *cfqq) return ELV_MQUEUE_MAY; } -static int cfq_may_queue(struct request_queue *q, int rw) +static int cfq_may_queue(struct request_queue *q, u64 rw) { struct cfq_data *cfqd = q->elevator->elevator_data; struct task_struct *tsk = current; diff --git a/block/elevator.c b/block/elevator.c index c3555c9c672f..5b9a615fd2df 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -352,7 +352,7 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq) { sector_t boundary; struct list_head *entry; - int stop_flags; + u64 stop_flags; if (q->last_merge == rq) q->last_merge = NULL; @@ -511,7 +511,7 @@ void elv_merge_requests(struct request_queue *q, struct request *rq, struct request *next) { struct elevator_queue *e = q->elevator; - const int next_sorted = next->cmd_flags & REQ_SORTED; + const bool next_sorted = (next->cmd_flags & REQ_SORTED) != 0; if (next_sorted && e->type->ops.elevator_merge_req_fn) e->type->ops.elevator_merge_req_fn(q, rq, next); @@ -717,7 +717,7 @@ void elv_put_request(struct request_queue *q, struct request *rq) e->type->ops.elevator_put_req_fn(rq); } -int elv_may_queue(struct request_queue *q, int rw) +int elv_may_queue(struct request_queue *q, u64 rw) { struct elevator_queue *e = q->elevator; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7e5d7e018bea..930bd4c5b7ff 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -615,7 +615,7 @@ static inline unsigned int blk_queue_cluster(struct request_queue *q) /* * We regard a request as sync, if either a read or a sync write */ -static inline bool rw_is_sync(unsigned int rw_flags) +static inline bool rw_is_sync(u64 rw_flags) { return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC); } diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 638b324f0291..a06cca4d0f1a 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -26,7 +26,7 @@ typedef int (elevator_dispatch_fn) (struct request_queue *, int); typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *); typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *); -typedef int (elevator_may_queue_fn) (struct request_queue *, int); +typedef int (elevator_may_queue_fn) (struct request_queue *, u64); typedef void (elevator_init_icq_fn) (struct io_cq *); typedef void (elevator_exit_icq_fn) (struct io_cq *); @@ -134,7 +134,7 @@ extern struct request *elv_former_request(struct request_queue *, struct request extern struct request *elv_latter_request(struct request_queue *, struct request *); extern int elv_register_queue(struct request_queue *q); extern void elv_unregister_queue(struct request_queue *q); -extern int elv_may_queue(struct request_queue *, int); +extern int elv_may_queue(struct request_queue *, u64); extern void elv_completed_request(struct request_queue *, struct request *); extern int elv_set_request(struct request_queue *q, struct request *rq, struct bio *bio, gfp_t gfp_mask);