From patchwork Fri May 25 21:14:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 10428511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71115601D5 for ; Fri, 25 May 2018 21:15:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 600DA297F2 for ; Fri, 25 May 2018 21:15:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54B84297F4; Fri, 25 May 2018 21:15:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0298A297F2 for ; Fri, 25 May 2018 21:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030239AbeEYVPW (ORCPT ); Fri, 25 May 2018 17:15:22 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36202 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030231AbeEYVPU (ORCPT ); Fri, 25 May 2018 17:15:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB5D2818BAFA; Fri, 25 May 2018 21:15:19 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id C36B8200BCBB; Fri, 25 May 2018 21:15:19 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 0B135655F73; Fri, 25 May 2018 17:15:19 -0400 (EDT) From: Jeff Moyer To: Damien.LeMoal@wdc.com, axboe@kernel.dk, linux-block@vger.kernel.org Cc: bgurney@redhat.com, Jeff Moyer Subject: [PATCH 1/2] block: __elevator_change: add try_loading parameter Date: Fri, 25 May 2018 17:14:31 -0400 Message-Id: <20180525211432.20359-2-jmoyer@redhat.com> In-Reply-To: <20180525211432.20359-1-jmoyer@redhat.com> References: <20180525211432.20359-1-jmoyer@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 25 May 2018 21:15:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 25 May 2018 21:15:19 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jmoyer@redhat.com' RCPT:'' Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The next patch will add a caller that can't trigger module loads. Also export this function for that caller. Signed-off-by: Jeff Moyer --- block/blk.h | 2 ++ block/elevator.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/block/blk.h b/block/blk.h index b034fd2..f6c3cc1 100644 --- a/block/blk.h +++ b/block/blk.h @@ -233,6 +233,8 @@ static inline void elv_deactivate_rq(struct request_queue *q, struct request *rq int elv_register_queue(struct request_queue *q); void elv_unregister_queue(struct request_queue *q); +int __elevator_change(struct request_queue *q, const char *name, + bool try_loading); struct hd_struct *__disk_get_part(struct gendisk *disk, int partno); diff --git a/block/elevator.c b/block/elevator.c index e87e9b4..5a91a43 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -1075,7 +1075,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) /* * Switch this queue to the given IO scheduler. */ -static int __elevator_change(struct request_queue *q, const char *name) +int __elevator_change(struct request_queue *q, const char *name, + bool try_loading) { char elevator_name[ELV_NAME_MAX]; struct elevator_type *e; @@ -1091,7 +1092,7 @@ static int __elevator_change(struct request_queue *q, const char *name) return elevator_switch(q, NULL); strlcpy(elevator_name, name, sizeof(elevator_name)); - e = elevator_get(q, strstrip(elevator_name), true); + e = elevator_get(q, strstrip(elevator_name), try_loading); if (!e) return -EINVAL; @@ -1119,7 +1120,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name, if (!(q->mq_ops || q->request_fn) || !elv_support_iosched(q)) return count; - ret = __elevator_change(q, name); + ret = __elevator_change(q, name, true); if (!ret) return count;