From patchwork Fri Oct 19 06:24:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Gilbert X-Patchwork-Id: 10648743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B74917D4 for ; Fri, 19 Oct 2018 06:25:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A7DA28ABE for ; Fri, 19 Oct 2018 06:25:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E1CF28AC2; Fri, 19 Oct 2018 06:25:06 +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 D2F6D28ABE for ; Fri, 19 Oct 2018 06:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbeJSO3n (ORCPT ); Fri, 19 Oct 2018 10:29:43 -0400 Received: from smtp.infotech.no ([82.134.31.41]:47377 "EHLO smtp.infotech.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbeJSO3n (ORCPT ); Fri, 19 Oct 2018 10:29:43 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id 1FAA3204247; Fri, 19 Oct 2018 08:25:02 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zAH+Zd--WCAN; Fri, 19 Oct 2018 08:25:00 +0200 (CEST) Received: from xtwo70.bingwo.ca (host-45-58-195-233.dyn.295.ca [45.58.195.233]) by smtp.infotech.no (Postfix) with ESMTPA id 9B6DF204147; Fri, 19 Oct 2018 08:24:59 +0200 (CEST) From: Douglas Gilbert To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, tonyb@cybernetics.com, hare@suse.de, bart.vanassche@wdc.com Subject: [PATCH 0/8] sg: major cleanup, remove max_queue limit Date: Fri, 19 Oct 2018 02:24:48 -0400 Message-Id: <20181019062456.4690-1-dgilbert@interlog.com> X-Mailer: git-send-email 2.17.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The intention is to add two new ioctls as proposed by Linus Torvalds: SG_IOSUBMIT and SG_IORECEIVE to replace the write()/read() async interface. But first, clean up the driver and remove the SG_MAX_QUEUE limit of no more than 16 queued commands on a file descriptor at a time. A free list has been added and the de-allocation of sg_request objects is deferred until the close() of a file. Locking is extensively reworked, especially at the struct sg_fd and sg_request level. A new SG_SET_GET_EXTENDED ioctl has been added. It allows multiple integer values and booleans to be written to and/or read from the driver. An example is changing and/or reading the reserved request data length (there is one of these per fd). An example of a new feature is changing and/or reading the per-fd upper limit on the sum of outstanding data buffer sizes (default is 16 MB). An example of a boolean is a bit to do all following command timekeeping in nanoseconds rather that the default millseconds. A later patchset will add implementations for the SG_IOSUBMIT and SG_IORECEIVE plus handling of the sg v4 interface with the existing SG_IO ioctl. This patchset is against Martin Petersen 4.20/scsi-queue branch. Douglas Gilbert (8): sg: types and naming cleanup sg: introduce sg_log macro sg: split header, expand and correct descriptions sg: expand request states sg: add free list, rework locking sg: complete locking changes on ioctl+debug sg: rework ioctl handling sg: user control for q_at_head or tail drivers/scsi/sg.c | 2484 ++++++++++++++++++++++++++-------------- include/scsi/sg.h | 252 +--- include/uapi/scsi/sg.h | 416 +++++++ 3 files changed, 2036 insertions(+), 1116 deletions(-) create mode 100644 include/uapi/scsi/sg.h