Skip to contentSkip to conversation

SPDX tag and top of file comment cleanups for the loop driver

PATCH Applied Christoph Hellwig 4 participants 14 messages Apr 19, 2022 – May 10, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Jens, hi Ted,

the loop driver still had no SPDX tag, so this series cleans up some lose ends and fixes that up.

Ted, does the SPDX tag match your original licensing decision back then, or do we need to correct it? Does the auto-converted tag on the loop.h SPDX header (GPL1.0 or later with syscall exception) make sense, or should that have been GPL2 only with syscall exception?

#1 lore raw

PATCH 1/4 loop: remove loop.h

Merge loop.h into loop.c as all the content is only used there.

---
 drivers/block/loop.c | 57 +++++++++++++++++++++++++++++++++--
 drivers/block/loop.h | 71 --------------------------------------------
 2 files changed, 54 insertions(+), 74 deletions(-)
 delete mode 100644 drivers/block/loop.h
drivers/block/loop.c +54 -3
index 0c7f0367200cc..f87bb136b66b4 100644
@@ -59,7 +59,6 @@
 #include <linux/errno.h>
 #include <linux/major.h>
 #include <linux/wait.h>
-#include <linux/blkdev.h>
 #include <linux/blkpg.h>
 #include <linux/init.h>
 #include <linux/swap.h>
@@ -80,10 +79,62 @@
 #include <linux/blk-cgroup.h>
 #include <linux/sched/mm.h>
 #include <linux/statfs.h>
+#include <linux/uaccess.h>
+#include <linux/blk-mq.h>
+#include <linux/spinlock.h>
+#include <uapi/linux/loop.h>
+
+/* 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 <linux/uaccess.h>
+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)
drivers/block/loop.h deleted +0 -71

71 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer Applied
#3 lore raw

Re: [PATCH 1/4] loop: remove loop.h

In reply to Christoph Hellwig
Quoted 3 lines · Christoph Hellwig

Merge loop.h into loop.c as all the content is only used there.

Applied, thanks!

[1/4] loop: remove loop.h

      commit: 754d96798fab1316f4f14bb86cf3c0244cb2b20b
[2/4] loop: add a SPDX header
      commit: f21e6e185a3a95dedc0d604b468d40ff1dc71fd9
[3/4] loop: remove most the top-of-file boilerplate comment
      commit: eb04bb154b76a0633afc5d26c1de7619a6686e9b
[4/4] loop: remove most the top-of-file boilerplate comment from the UAPI header
      commit: c23d47abee3a54e4991ed3993340596d04aabd6a

Best regards,

Signature · 1 line
Jens Axboe
#4 lore raw

PATCH 2/4 loop: add a SPDX header

In reply to Christoph Hellwig

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.

---
 drivers/block/loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/loop.c +2 -2
index f87bb136b66b4..b87151b60dc20 100644
@@ -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
Signature · 1 line
2.30.2
#5 lore raw

PATCH 3/4 loop: remove most the top-of-file boilerplate comment

In reply to Christoph Hellwig

Remove the irrelevant changelogs and todo notes and just leave the SPDX marker and the copyright notice.

---
 drivers/block/loop.c | 47 --------------------------------------------
 1 file changed, 47 deletions(-)
drivers/block/loop.c +0 -47
index b87151b60dc20..919c96c15be87 100644
@@ -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 - [email protected] Mar 20, 1997
- *
- * Added devfs support - Richard Gooch <[email protected]> 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, [email protected]
- *
- * Maximum number of loop devices now dynamic via max_loop module parameter.
- * Russell Kroll <[email protected]> 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ø, <[email protected]>, 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 <[email protected]>, Nov 2000
- *
- * Support up to 256 loop devices
- * Heinz Mauelshagen <[email protected]>, 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 <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/sched.h>
Signature · 1 line
2.30.2
#7 lore raw

PATCH 4/4 loop: remove most the top-of-file boilerplate comment from the UAPI header

In reply to Christoph Hellwig

Just leave the SPDX marker and the copyright notice and remove the irrelevant rest.

---
 include/uapi/linux/loop.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
include/uapi/linux/loop.h +1 -6
index 98e60801195e2..6f63527dd2ed6 100644
@@ -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
Signature · 1 line
2.30.2
#8 lore raw
In reply to Christoph Hellwig
Quoted 9 lines · Christoph Hellwig

Hi Jens, hi Ted,

the loop driver still had no SPDX tag, so this series cleans up some lose ends and fixes that up.

Ted, does the SPDX tag match your original licensing decision back then, or do we need to correct it? Does the auto-converted tag on the loop.h SPDX header (GPL1.0 or later with syscall exception) make sense, or should that have been GPL2 only with syscall exception?

I think you've removed the loop.h in the patch series, so it shouldn't matter what the tag would be for loop.h, right? In any case, GPLv2 only was certainly the intent at the time.

Cheers,

- Ted

#9 lore raw
Quoted 8 lines · Theodore Ts'o
Quoted 4 lines

Ted, does the SPDX tag match your original licensing decision back then, or do we need to correct it? Does the auto-converted tag on the loop.h SPDX header (GPL1.0 or later with syscall exception) make sense, or should that have been GPL2 only with syscall exception?

I think you've removed the loop.h in the patch series, so it shouldn't matter what the tag would be for loop.h, right? In any case, GPLv2 only was certainly the intent at the time.

Well, there were two loop.h files - drivers/block/loop.h gets removed in this series, but include/uapi/linux/loop.h stays.

#10 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Theodore Ts'o
Quoted 4 lines

Ted, does the SPDX tag match your original licensing decision back then, or do we need to correct it? Does the auto-converted tag on the loop.h SPDX header (GPL1.0 or later with syscall exception) make sense, or should that have been GPL2 only with syscall exception?

Quoted 6 lines
Quoted 3 lines

I think you've removed the loop.h in the patch series, so it shouldn't matter what the tag would be for loop.h, right? In any case, GPLv2 only was certainly the intent at the time.

Well, there were two loop.h files - drivers/block/loop.h gets removed in this series, but include/uapi/linux/loop.h stays.

Ah, thanks for the clarification. Yes, GPLv2 with the syscall extension is what would be appropriate for include/uapi/linux/loop.h.

- Ted

#11 lore raw

Jens,

are the comments from Ted here enough to apply the series? Or do we need a formal Acked-by to be on the safe side?

Quoted 11 lines · tytso
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Theodore Ts'o
Quoted 4 lines

Ted, does the SPDX tag match your original licensing decision back then, or do we need to correct it? Does the auto-converted tag on the loop.h SPDX header (GPL1.0 or later with syscall exception) make sense, or should that have been GPL2 only with syscall exception?

I think you've removed the loop.h in the patch series, so it shouldn't matter what the tag would be for loop.h, right? In any case, GPLv2 only was certainly the intent at the time.

Quoted 7 lines
Quoted 2 lines

Well, there were two loop.h files - drivers/block/loop.h gets removed in this series, but include/uapi/linux/loop.h stays.

Ah, thanks for the clarification. Yes, GPLv2 with the syscall extension is what would be appropriate for include/uapi/linux/loop.h.

- Ted

---end quoted text---

maintainer
#12 lore raw
Quoted 4 lines · Christoph Hellwig

Jens,

are the comments from Ted here enough to apply the series? Or do we need a formal Acked-by to be on the safe side?

Looks conclusive enough to me - if not, Ted, please holler. I'll queue it up.

Signature · 1 line
Jens Axboe
#13 lore raw
Quoted 8 lines · Jens Axboe
Quoted 4 lines · Christoph Hellwig

Jens,

are the comments from Ted here enough to apply the series? Or do we need a formal Acked-by to be on the safe side?

Looks conclusive enough to me - if not, Ted, please holler. I'll queue it up.

Sounds good, thanks so much Jens!

- Ted