From patchwork Tue Apr 19 06:33:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12817430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C81ACC433F5 for ; Tue, 19 Apr 2022 06:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348855AbiDSGfw (ORCPT ); Tue, 19 Apr 2022 02:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237280AbiDSGfv (ORCPT ); Tue, 19 Apr 2022 02:35:51 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611392611F; Mon, 18 Apr 2022 23:33:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Cxk+WPrkLvXUy5WBfq1DQOttUDV888u1Wm8RxmiOZ5c=; b=BapnGvRpa21Ngt4hbHoaIGgvB9 WVvf/rjjr/3jRM1DksCm9WUkxwUmouFpC5NJ7FOgktpYlwkNR3GoCNLWUsqzIA4p19WskRXJcZTZJ ufo9hbOKvVExSENKpgVnaAPZJFlpoCM1Iwz6j4QDQ9R3DKCDEiex803D9oo/334roph/7x9eRmhlb zWhNab0KI8jLUx2g1Fp6S8joKmUjw20ihTqH6q9BxNtij126LqeEUYzP4v5BpU7e7oAe9aV2UTWzp 7J4vlL9/ldLLDx3w69Erc8otuTVdzxGwJwJETdHRfLsE5EYLYpe7fFykWl39MGAdIxfwEjGW8zZIw KXidgDOQ==; Received: from [2001:4bb8:191:364b:8ef6:df8:5a60:ae5d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghQB-001hzH-SC; Tue, 19 Apr 2022 06:33:08 +0000 From: Christoph Hellwig To: Jens Axboe , "Theodore Ts'o" Cc: linux-block@vger.kernel.org, linux-spdx@vger.kernel.org Subject: [PATCH 1/4] loop: remove loop.h Date: Tue, 19 Apr 2022 08:33:00 +0200 Message-Id: <20220419063303.583106-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220419063303.583106-1-hch@lst.de> References: <20220419063303.583106-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Merge loop.h into loop.c as all the content is only used there. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/block/loop.c | 57 +++++++++++++++++++++++++++++++++-- drivers/block/loop.h | 71 -------------------------------------------- 2 files changed, 54 insertions(+), 74 deletions(-) delete mode 100644 drivers/block/loop.h diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 0c7f0367200cc..f87bb136b66b4 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -80,10 +79,62 @@ #include #include #include +#include +#include +#include +#include + +/* Possible states of device */ +enum { + Lo_unbound, + Lo_bound, + Lo_rundown, + Lo_deleting, +}; -#include "loop.h" +struct loop_func_table; + +struct loop_device { + int lo_number; + loff_t lo_offset; + loff_t lo_sizelimit; + int lo_flags; + char lo_file_name[LO_NAME_SIZE]; + + struct file * lo_backing_file; + struct block_device *lo_device; + + gfp_t old_gfp_mask; + + spinlock_t lo_lock; + int lo_state; + spinlock_t lo_work_lock; + struct workqueue_struct *workqueue; + struct work_struct rootcg_work; + struct list_head rootcg_cmd_list; + struct list_head idle_worker_list; + struct rb_root worker_tree; + struct timer_list timer; + bool use_dio; + bool sysfs_inited; + + struct request_queue *lo_queue; + struct blk_mq_tag_set tag_set; + struct gendisk *lo_disk; + struct mutex lo_mutex; + bool idr_visible; +}; -#include +struct loop_cmd { + struct list_head list_entry; + bool use_aio; /* use AIO interface to handle I/O */ + atomic_t ref; /* only for aio */ + long ret; + struct kiocb iocb; + struct bio_vec *bvec; + struct cgroup_subsys_state *blkcg_css; + struct cgroup_subsys_state *memcg_css; +}; #define LOOP_IDLE_WORKER_TIMEOUT (60 * HZ) #define LOOP_DEFAULT_HW_Q_DEPTH (128) diff --git a/drivers/block/loop.h b/drivers/block/loop.h deleted file mode 100644 index 449d562738c52..0000000000000 --- a/drivers/block/loop.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * loop.h - * - * Written by Theodore Ts'o, 3/29/93. - * - * Copyright 1993 by Theodore Ts'o. Redistribution of this file is - * permitted under the GNU General Public License. - */ -#ifndef _LINUX_LOOP_H -#define _LINUX_LOOP_H - -#include -#include -#include -#include -#include -#include - -/* Possible states of device */ -enum { - Lo_unbound, - Lo_bound, - Lo_rundown, - Lo_deleting, -}; - -struct loop_func_table; - -struct loop_device { - int lo_number; - loff_t lo_offset; - loff_t lo_sizelimit; - int lo_flags; - char lo_file_name[LO_NAME_SIZE]; - - struct file * lo_backing_file; - struct block_device *lo_device; - - gfp_t old_gfp_mask; - - spinlock_t lo_lock; - int lo_state; - spinlock_t lo_work_lock; - struct workqueue_struct *workqueue; - struct work_struct rootcg_work; - struct list_head rootcg_cmd_list; - struct list_head idle_worker_list; - struct rb_root worker_tree; - struct timer_list timer; - bool use_dio; - bool sysfs_inited; - - struct request_queue *lo_queue; - struct blk_mq_tag_set tag_set; - struct gendisk *lo_disk; - struct mutex lo_mutex; - bool idr_visible; -}; - -struct loop_cmd { - struct list_head list_entry; - bool use_aio; /* use AIO interface to handle I/O */ - atomic_t ref; /* only for aio */ - long ret; - struct kiocb iocb; - struct bio_vec *bvec; - struct cgroup_subsys_state *blkcg_css; - struct cgroup_subsys_state *memcg_css; -}; - -#endif From patchwork Tue Apr 19 06:33:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12817431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1244C4332F for ; Tue, 19 Apr 2022 06:33:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348859AbiDSGfx (ORCPT ); Tue, 19 Apr 2022 02:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237377AbiDSGfx (ORCPT ); Tue, 19 Apr 2022 02:35:53 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F38B02611F; Mon, 18 Apr 2022 23:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=7aG/PbvADzbqL2ouZgBB0f/ZCAoM5xZzFnGCoC1Qb4c=; b=TSzKkejEbzOQcmmx5aR0K+TnnB mfM/LUMHTPPo3xUwfkueFooqr6PZZwKbWl28L391WW7Cm+10cFOWTLBoQEUZHWu0t/j0f7Iqet/H9 y89lITFy5nCBp4zS2iVqZXUHeEXYimX7mbKSH+rmKtkddsj5K1qUfdYwrvfFskGmV3AWX0sJhhnSJ SkdhiPTSdMD4gbh3m4SSa3th1/g4FP2BG+TpICmQnFEuFY+dirE6WbOp+XTX25fzMZ/C5Sf7MATei ofLGPDa4w7dN8p4Gu2K1gtF1YFl3Ch1THiMus+GwAont73lKfc0lr7udBr3L3Gd4qE+y3z/OfCENB Anpa7u3g==; Received: from [2001:4bb8:191:364b:8ef6:df8:5a60:ae5d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghQE-001hzY-FF; Tue, 19 Apr 2022 06:33:10 +0000 From: Christoph Hellwig To: Jens Axboe , "Theodore Ts'o" Cc: linux-block@vger.kernel.org, linux-spdx@vger.kernel.org Subject: [PATCH 2/4] loop: add a SPDX header Date: Tue, 19 Apr 2022 08:33:01 +0200 Message-Id: <20220419063303.583106-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220419063303.583106-1-hch@lst.de> References: <20220419063303.583106-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The copyright statement says: "Redistribution of this file is permitted under the GNU General Public License." and was added by Ted in 1993, at which point GPLv2 only was the default Linux license. Replace it with the usual GPLv2 only SPDX header. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index f87bb136b66b4..b87151b60dc20 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1,10 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * linux/drivers/block/loop.c * * Written by Theodore Ts'o, 3/29/93 * - * Copyright 1993 by Theodore Ts'o. Redistribution of this file is - * permitted under the GNU General Public License. + * Copyright 1993 by Theodore Ts'o. * * DES encryption plus some minor changes by Werner Almesberger, 30-MAY-1993 * more DES encryption plus IDEA encryption by Nicholas J. Leon, June 20, 1996 From patchwork Tue Apr 19 06:33:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12817432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E44A4C433FE for ; Tue, 19 Apr 2022 06:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348860AbiDSGf4 (ORCPT ); Tue, 19 Apr 2022 02:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237280AbiDSGfz (ORCPT ); Tue, 19 Apr 2022 02:35:55 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 770422611F; Mon, 18 Apr 2022 23:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=nUuX50OOwwXYW2i4N0xMsaYgoS/f9c5Drxd0p73beA0=; b=gTnPzgLUBRkVe6fgxsHngbj2lc rQFfKS23bN1U7xiZNqKP8SX2IG7owEtY9cCyUMol2l9BisjYIYaGWEDQ7zWpgDCePVdJv2ADLersU IA1aEE0f1tf/3FGc0puhsdBXfr6ceLAPk+vDav9QE66CiOUUgESaFw36274YN4X1ijX11QGXc8ha8 IapIlzn3cpOKsc9HnY1+tJpOfeI3oAeQa6bcULvhnQ0KShN/bcfsB89a3OVVuo2IpbQAizfnDRPgP vz+oYCVWfl+ZNdHEHDdJF6zx56IFV3URiL1e1VPp7+mqlL4EF93x7A3LFcptEfEXxgSi1w7RhjItL ER+EEfYQ==; Received: from [2001:4bb8:191:364b:8ef6:df8:5a60:ae5d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghQH-001i0G-0y; Tue, 19 Apr 2022 06:33:13 +0000 From: Christoph Hellwig To: Jens Axboe , "Theodore Ts'o" Cc: linux-block@vger.kernel.org, linux-spdx@vger.kernel.org Subject: [PATCH 3/4] loop: remove most the top-of-file boilerplate comment Date: Tue, 19 Apr 2022 08:33:02 +0200 Message-Id: <20220419063303.583106-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220419063303.583106-1-hch@lst.de> References: <20220419063303.583106-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Remove the irrelevant changelogs and todo notes and just leave the SPDX marker and the copyright notice. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/block/loop.c | 47 -------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index b87151b60dc20..919c96c15be87 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1,54 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * linux/drivers/block/loop.c - * - * Written by Theodore Ts'o, 3/29/93 - * * Copyright 1993 by Theodore Ts'o. - * - * DES encryption plus some minor changes by Werner Almesberger, 30-MAY-1993 - * more DES encryption plus IDEA encryption by Nicholas J. Leon, June 20, 1996 - * - * Modularized and updated for 1.1.16 kernel - Mitch Dsouza 28th May 1994 - * Adapted for 1.3.59 kernel - Andries Brouwer, 1 Feb 1996 - * - * Fixed do_loop_request() re-entrancy - Vincent.Renardias@waw.com Mar 20, 1997 - * - * Added devfs support - Richard Gooch 16-Jan-1998 - * - * Handle sparse backing files correctly - Kenn Humborg, Jun 28, 1998 - * - * Loadable modules and other fixes by AK, 1998 - * - * Make real block number available to downstream transfer functions, enables - * CBC (and relatives) mode encryption requiring unique IVs per data block. - * Reed H. Petty, rhp@draper.net - * - * Maximum number of loop devices now dynamic via max_loop module parameter. - * Russell Kroll 19990701 - * - * Maximum number of loop devices when compiled-in now selectable by passing - * max_loop=<1-255> to the kernel on boot. - * Erik I. Bolsø, , Oct 31, 1999 - * - * Completely rewrite request handling to be make_request_fn style and - * non blocking, pushing work to a helper thread. Lots of fixes from - * Al Viro too. - * Jens Axboe , Nov 2000 - * - * Support up to 256 loop devices - * Heinz Mauelshagen , Feb 2002 - * - * Support for falling back on the write file operation when the address space - * operations write_begin is not available on the backing filesystem. - * Anton Altaparmakov, 16 Feb 2005 - * - * Still To Fix: - * - Advisory locking is ignored here. - * - Should use an own CAP_* category instead of CAP_SYS_ADMIN - * */ - #include #include #include From patchwork Tue Apr 19 06:33:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12817433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E00DC433F5 for ; Tue, 19 Apr 2022 06:33:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348866AbiDSGgA (ORCPT ); Tue, 19 Apr 2022 02:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237280AbiDSGf7 (ORCPT ); Tue, 19 Apr 2022 02:35:59 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1819D2611F; Mon, 18 Apr 2022 23:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=p+NLQwzImL098ZQLVg3qNIFs+TqTKrzJhpz7yD8KxCE=; b=ycGVL8ui5+jwMoAY7Zi1/uqt1I /4G3mLyfmZPO/ncA13nYWZaOdDSW/EK9OBileaz9roqqdAm1Noo5SPPX1m1vX+uAFPB9Ug5bZJjCy vrxue4SxJo3vSDrB+9TTsuS9SB1Up+TkLPT7Hv2DYF5kR9t8B8tuPrCZvS5zi7XdUsYTw/H6r52Zu +5OWod33+8vKBjGSO3/W1BfDRqI89XgYVlJoCT+J1s08H4jtwKFFTPLsEJGX5bDtg6OWQPwFgkn2d FqByKVPN35XkFjZbLWCdjJfx0Cvpi+JxcN/Z5nt5aD4h9sA2ZWLghdMPwN5Zqf8BKJENJkcUQ2klk aTAGpngA==; Received: from [2001:4bb8:191:364b:8ef6:df8:5a60:ae5d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghQJ-001i13-J7; Tue, 19 Apr 2022 06:33:16 +0000 From: Christoph Hellwig To: Jens Axboe , "Theodore Ts'o" Cc: linux-block@vger.kernel.org, linux-spdx@vger.kernel.org Subject: [PATCH 4/4] loop: remove most the top-of-file boilerplate comment from the UAPI header Date: Tue, 19 Apr 2022 08:33:03 +0200 Message-Id: <20220419063303.583106-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220419063303.583106-1-hch@lst.de> References: <20220419063303.583106-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Just leave the SPDX marker and the copyright notice and remove the irrelevant rest. Signed-off-by: Christoph Hellwig --- include/uapi/linux/loop.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/uapi/linux/loop.h b/include/uapi/linux/loop.h index 98e60801195e2..6f63527dd2ed6 100644 --- a/include/uapi/linux/loop.h +++ b/include/uapi/linux/loop.h @@ -1,11 +1,6 @@ /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* - * include/linux/loop.h - * - * Written by Theodore Ts'o, 3/29/93. - * - * Copyright 1993 by Theodore Ts'o. Redistribution of this file is - * permitted under the GNU General Public License. + * Copyright 1993 by Theodore Ts'o. */ #ifndef _UAPI_LINUX_LOOP_H #define _UAPI_LINUX_LOOP_H