License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2021-09-20 20:33:23 +08:00
|
|
|
#ifndef _ELEVATOR_H
|
|
|
|
#define _ELEVATOR_H
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-07-22 21:37:43 +08:00
|
|
|
#include <linux/percpu.h>
|
2012-12-17 23:01:27 +08:00
|
|
|
#include <linux/hashtable.h>
|
2023-04-13 14:40:56 +08:00
|
|
|
#include "blk-mq.h"
|
2006-07-22 21:37:43 +08:00
|
|
|
|
2011-12-14 07:33:42 +08:00
|
|
|
struct io_cq;
|
2013-07-03 19:25:24 +08:00
|
|
|
struct elevator_type;
|
2017-05-04 22:24:40 +08:00
|
|
|
struct blk_mq_debugfs_attr;
|
2011-12-14 07:33:42 +08:00
|
|
|
|
2017-02-08 21:46:48 +08:00
|
|
|
/*
|
|
|
|
* Return values from elevator merger
|
|
|
|
*/
|
|
|
|
enum elv_merge {
|
|
|
|
ELEVATOR_NO_MERGE = 0,
|
|
|
|
ELEVATOR_FRONT_MERGE = 1,
|
|
|
|
ELEVATOR_BACK_MERGE = 2,
|
2017-02-08 21:46:49 +08:00
|
|
|
ELEVATOR_DISCARD_MERGE = 3,
|
2017-02-08 21:46:48 +08:00
|
|
|
};
|
|
|
|
|
2017-01-17 21:03:22 +08:00
|
|
|
struct blk_mq_alloc_data;
|
|
|
|
struct blk_mq_hw_ctx;
|
|
|
|
|
|
|
|
struct elevator_mq_ops {
|
|
|
|
int (*init_sched)(struct request_queue *, struct elevator_type *);
|
|
|
|
void (*exit_sched)(struct elevator_queue *);
|
2017-04-06 03:01:34 +08:00
|
|
|
int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int);
|
|
|
|
void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int);
|
2019-01-19 01:34:16 +08:00
|
|
|
void (*depth_updated)(struct blk_mq_hw_ctx *);
|
2017-01-17 21:03:22 +08:00
|
|
|
|
|
|
|
bool (*allow_merge)(struct request_queue *, struct request *, struct bio *);
|
2021-05-11 08:05:35 +08:00
|
|
|
bool (*bio_merge)(struct request_queue *, struct bio *, unsigned int);
|
2017-01-17 21:03:22 +08:00
|
|
|
int (*request_merge)(struct request_queue *q, struct request **, struct bio *);
|
2017-02-08 21:46:48 +08:00
|
|
|
void (*request_merged)(struct request_queue *, struct request *, enum elv_merge);
|
2017-01-17 21:03:22 +08:00
|
|
|
void (*requests_merged)(struct request_queue *, struct request *, struct request *);
|
2022-07-15 02:06:32 +08:00
|
|
|
void (*limit_depth)(blk_opf_t, struct blk_mq_alloc_data *);
|
2020-05-29 21:53:08 +08:00
|
|
|
void (*prepare_request)(struct request *);
|
2017-06-17 00:15:21 +08:00
|
|
|
void (*finish_request)(struct request *);
|
2023-04-13 14:40:56 +08:00
|
|
|
void (*insert_requests)(struct blk_mq_hw_ctx *hctx, struct list_head *list,
|
|
|
|
blk_insert_t flags);
|
2017-01-27 03:40:07 +08:00
|
|
|
struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);
|
2017-01-17 21:03:22 +08:00
|
|
|
bool (*has_work)(struct blk_mq_hw_ctx *);
|
2018-09-28 06:55:51 +08:00
|
|
|
void (*completed_request)(struct request *, u64);
|
2017-01-17 21:03:22 +08:00
|
|
|
void (*requeue_request)(struct request *);
|
|
|
|
struct request *(*former_request)(struct request_queue *, struct request *);
|
|
|
|
struct request *(*next_request)(struct request_queue *, struct request *);
|
|
|
|
void (*init_icq)(struct io_cq *);
|
|
|
|
void (*exit_icq)(struct io_cq *);
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define ELV_NAME_MAX (16)
|
|
|
|
|
2006-03-19 11:27:18 +08:00
|
|
|
struct elv_fs_entry {
|
|
|
|
struct attribute attr;
|
2008-10-31 17:05:07 +08:00
|
|
|
ssize_t (*show)(struct elevator_queue *, char *);
|
|
|
|
ssize_t (*store)(struct elevator_queue *, const char *, size_t);
|
2006-03-19 11:27:18 +08:00
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* identifies an elevator type, such as AS or deadline
|
|
|
|
*/
|
|
|
|
struct elevator_type
|
|
|
|
{
|
2011-12-14 07:33:42 +08:00
|
|
|
/* managed by elevator core */
|
|
|
|
struct kmem_cache *icq_cache;
|
|
|
|
|
|
|
|
/* fields provided by elevator implementation */
|
2018-11-02 06:41:41 +08:00
|
|
|
struct elevator_mq_ops ops;
|
block: remove dead elevator code
This removes a bunch of core and elevator related code. On the core
front, we remove anything related to queue running, draining,
initialization, plugging, and congestions. We also kill anything
related to request allocation, merging, retrieval, and completion.
Remove any checking for single queue IO schedulers, as they no
longer exist. This means we can also delete a bunch of code related
to request issue, adding, completion, etc - and all the SQ related
ops and helpers.
Also kill the load_default_modules(), as all that did was provide
for a way to load the default single queue elevator.
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-10-30 00:23:51 +08:00
|
|
|
|
2011-12-14 07:33:42 +08:00
|
|
|
size_t icq_size; /* see iocontext.h */
|
|
|
|
size_t icq_align; /* ditto */
|
2006-03-19 11:27:18 +08:00
|
|
|
struct elv_fs_entry *elevator_attrs;
|
2019-07-10 23:57:41 +08:00
|
|
|
const char *elevator_name;
|
2017-10-26 02:35:02 +08:00
|
|
|
const char *elevator_alias;
|
2019-09-05 17:51:31 +08:00
|
|
|
const unsigned int elevator_features;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct module *elevator_owner;
|
2017-05-04 22:24:40 +08:00
|
|
|
#ifdef CONFIG_BLK_DEBUG_FS
|
|
|
|
const struct blk_mq_debugfs_attr *queue_debugfs_attrs;
|
|
|
|
const struct blk_mq_debugfs_attr *hctx_debugfs_attrs;
|
|
|
|
#endif
|
2011-12-14 07:33:42 +08:00
|
|
|
|
|
|
|
/* managed by elevator core */
|
2017-06-03 11:35:51 +08:00
|
|
|
char icq_cache_name[ELV_NAME_MAX + 6]; /* elvname + "_io_cq" */
|
2011-12-14 07:33:41 +08:00
|
|
|
struct list_head list;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2022-10-20 14:48:16 +08:00
|
|
|
static inline bool elevator_tryget(struct elevator_type *e)
|
|
|
|
{
|
|
|
|
return try_module_get(e->elevator_owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __elevator_get(struct elevator_type *e)
|
|
|
|
{
|
|
|
|
__module_get(e->elevator_owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void elevator_put(struct elevator_type *e)
|
|
|
|
{
|
|
|
|
module_put(e->elevator_owner);
|
|
|
|
}
|
|
|
|
|
2012-12-17 23:01:27 +08:00
|
|
|
#define ELV_HASH_BITS 6
|
|
|
|
|
2016-12-07 23:43:31 +08:00
|
|
|
void elv_rqhash_del(struct request_queue *q, struct request *rq);
|
|
|
|
void elv_rqhash_add(struct request_queue *q, struct request *rq);
|
|
|
|
void elv_rqhash_reposition(struct request_queue *q, struct request *rq);
|
|
|
|
struct request *elv_rqhash_find(struct request_queue *q, sector_t offset);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2006-01-10 07:09:36 +08:00
|
|
|
* each queue has an elevator_queue associated with it
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
struct elevator_queue
|
|
|
|
{
|
2011-12-14 07:33:41 +08:00
|
|
|
struct elevator_type *type;
|
2005-04-17 06:20:36 +08:00
|
|
|
void *elevator_data;
|
|
|
|
struct kobject kobj;
|
2006-03-19 07:35:43 +08:00
|
|
|
struct mutex sysfs_lock;
|
2022-10-19 20:15:17 +08:00
|
|
|
unsigned long flags;
|
2012-12-17 23:01:27 +08:00
|
|
|
DECLARE_HASHTABLE(hash, ELV_HASH_BITS);
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2022-10-19 20:15:18 +08:00
|
|
|
#define ELEVATOR_FLAG_REGISTERED 0
|
|
|
|
#define ELEVATOR_FLAG_DISABLE_WBT 1
|
2022-10-19 20:15:17 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* block elevator interface
|
|
|
|
*/
|
2017-02-08 21:46:48 +08:00
|
|
|
extern enum elv_merge elv_merge(struct request_queue *, struct request **,
|
|
|
|
struct bio *);
|
2007-07-24 15:28:11 +08:00
|
|
|
extern void elv_merge_requests(struct request_queue *, struct request *,
|
2005-04-17 06:20:36 +08:00
|
|
|
struct request *);
|
2017-02-08 21:46:48 +08:00
|
|
|
extern void elv_merged_request(struct request_queue *, struct request *,
|
|
|
|
enum elv_merge);
|
2021-06-23 17:36:34 +08:00
|
|
|
extern bool elv_attempt_insert_merge(struct request_queue *, struct request *,
|
|
|
|
struct list_head *);
|
2007-07-24 15:28:11 +08:00
|
|
|
extern struct request *elv_former_request(struct request_queue *, struct request *);
|
|
|
|
extern struct request *elv_latter_request(struct request_queue *, struct request *);
|
2021-06-02 14:53:17 +08:00
|
|
|
void elevator_init_mq(struct request_queue *q);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* io scheduler registration
|
|
|
|
*/
|
2014-06-23 06:32:48 +08:00
|
|
|
extern int elv_register(struct elevator_type *);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void elv_unregister(struct elevator_type *);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* io scheduler sysfs switching
|
|
|
|
*/
|
2007-07-24 15:28:11 +08:00
|
|
|
extern ssize_t elv_iosched_show(struct request_queue *, char *);
|
|
|
|
extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-07-08 02:48:22 +08:00
|
|
|
extern bool elv_bio_merge_ok(struct request *, struct bio *);
|
2013-07-03 19:25:24 +08:00
|
|
|
extern struct elevator_queue *elevator_alloc(struct request_queue *,
|
|
|
|
struct elevator_type *);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-07-13 17:55:04 +08:00
|
|
|
/*
|
|
|
|
* Helper functions.
|
|
|
|
*/
|
2007-07-24 15:28:11 +08:00
|
|
|
extern struct request *elv_rb_former_request(struct request_queue *, struct request *);
|
|
|
|
extern struct request *elv_rb_latter_request(struct request_queue *, struct request *);
|
2006-07-13 17:55:04 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rb support functions.
|
|
|
|
*/
|
iosched: prevent aliased requests from starving other I/O
Hi, Jens,
If you recall, I posted an RFC patch for this back in July of last year:
http://lkml.org/lkml/2010/7/13/279
The basic problem is that a process can issue a never-ending stream of
async direct I/Os to the same sector on a device, thus starving out
other I/O in the system (due to the way the alias handling works in both
cfq and deadline). The solution I proposed back then was to start
dispatching from the fifo after a certain number of aliases had been
dispatched. Vivek asked why we had to treat aliases differently at all,
and I never had a good answer. So, I put together a simple patch which
allows aliases to be added to the rb tree (it adds them to the right,
though that doesn't matter as the order isn't guaranteed anyway). I
think this is the preferred solution, as it doesn't break up time slices
in CFQ or batches in deadline. I've tested it, and it does solve the
starvation issue. Let me know what you think.
Cheers,
Jeff
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2011-06-03 03:19:05 +08:00
|
|
|
extern void elv_rb_add(struct rb_root *, struct request *);
|
2006-07-13 17:55:04 +08:00
|
|
|
extern void elv_rb_del(struct rb_root *, struct request *);
|
|
|
|
extern struct request *elv_rb_find(struct rb_root *, sector_t);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Insertion selection
|
|
|
|
*/
|
|
|
|
#define ELEVATOR_INSERT_FRONT 1
|
|
|
|
#define ELEVATOR_INSERT_BACK 2
|
|
|
|
#define ELEVATOR_INSERT_SORT 3
|
2006-01-06 16:51:03 +08:00
|
|
|
#define ELEVATOR_INSERT_REQUEUE 4
|
2011-01-25 19:43:54 +08:00
|
|
|
#define ELEVATOR_INSERT_FLUSH 5
|
2011-03-21 17:14:27 +08:00
|
|
|
#define ELEVATOR_INSERT_SORT_MERGE 6
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-07-13 17:55:04 +08:00
|
|
|
#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
|
2005-10-20 22:37:00 +08:00
|
|
|
|
2006-07-12 03:49:15 +08:00
|
|
|
#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
|
2014-02-24 23:39:53 +08:00
|
|
|
#define rq_fifo_clear(rq) list_del_init(&(rq)->queuelist)
|
2006-07-12 03:49:15 +08:00
|
|
|
|
2021-09-20 20:33:23 +08:00
|
|
|
#endif /* _ELEVATOR_H */
|