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 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 00:20:36 +02:00
|
|
|
#ifndef _RAID10_H
|
|
|
|
#define _RAID10_H
|
|
|
|
|
2018-02-02 23:19:30 +01:00
|
|
|
/* Note: raid10_info.rdev can be set to NULL asynchronously by
|
|
|
|
* raid10_remove_disk.
|
|
|
|
* There are three safe ways to access raid10_info.rdev.
|
|
|
|
* 1/ when holding mddev->reconfig_mutex
|
|
|
|
* 2/ when resync/recovery/reshape is known to be happening - i.e. in code
|
|
|
|
* that is called as part of performing resync/recovery/reshape.
|
|
|
|
* 3/ while holding rcu_read_lock(), use rcu_dereference to get the pointer
|
|
|
|
* and if it is non-NULL, increment rdev->nr_pending before dropping the
|
|
|
|
* RCU lock.
|
|
|
|
* When .rdev is set to NULL, the nr_pending count checked again and if it has
|
|
|
|
* been incremented, the pointer is put back in .rdev.
|
|
|
|
*/
|
|
|
|
|
2012-07-31 02:03:52 +02:00
|
|
|
struct raid10_info {
|
2011-12-23 00:17:54 +01:00
|
|
|
struct md_rdev *rdev, *replacement;
|
2005-04-17 00:20:36 +02:00
|
|
|
sector_t head_position;
|
2011-07-27 03:00:36 +02:00
|
|
|
int recovery_disabled; /* matches
|
|
|
|
* mddev->recovery_disabled
|
|
|
|
* when we shouldn't try
|
|
|
|
* recovering this device.
|
|
|
|
*/
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
2011-10-11 07:49:02 +02:00
|
|
|
struct r10conf {
|
2011-10-11 07:47:53 +02:00
|
|
|
struct mddev *mddev;
|
2012-07-31 02:03:52 +02:00
|
|
|
struct raid10_info *mirrors;
|
|
|
|
struct raid10_info *mirrors_new, *mirrors_old;
|
2005-04-17 00:20:36 +02:00
|
|
|
spinlock_t device_lock;
|
|
|
|
|
|
|
|
/* geometry */
|
2012-05-21 01:28:20 +02:00
|
|
|
struct geom {
|
|
|
|
int raid_disks;
|
|
|
|
int near_copies; /* number of copies laid out
|
2011-12-23 00:17:54 +01:00
|
|
|
* raid0 style */
|
2012-05-21 01:28:20 +02:00
|
|
|
int far_copies; /* number of copies laid out
|
2005-04-17 00:20:36 +02:00
|
|
|
* at large strides across drives
|
|
|
|
*/
|
2012-05-21 01:28:20 +02:00
|
|
|
int far_offset; /* far_copies are offset by 1
|
2011-12-23 00:17:54 +01:00
|
|
|
* stripe instead of many
|
2006-06-26 09:27:41 +02:00
|
|
|
*/
|
2012-05-21 01:28:20 +02:00
|
|
|
sector_t stride; /* distance between far copies.
|
2006-06-26 09:27:41 +02:00
|
|
|
* This is size / far_copies unless
|
|
|
|
* far_offset, in which case it is
|
|
|
|
* 1 stripe.
|
2005-04-17 00:20:36 +02:00
|
|
|
*/
|
MD RAID10: Improve redundancy for 'far' and 'offset' algorithms (part 1)
The MD RAID10 'far' and 'offset' algorithms make copies of entire stripe
widths - copying them to a different location on the same devices after
shifting the stripe. An example layout of each follows below:
"far" algorithm
dev1 dev2 dev3 dev4 dev5 dev6
==== ==== ==== ==== ==== ====
A B C D E F
G H I J K L
...
F A B C D E --> Copy of stripe0, but shifted by 1
L G H I J K
...
"offset" algorithm
dev1 dev2 dev3 dev4 dev5 dev6
==== ==== ==== ==== ==== ====
A B C D E F
F A B C D E --> Copy of stripe0, but shifted by 1
G H I J K L
L G H I J K
...
Redundancy for these algorithms is gained by shifting the copied stripes
one device to the right. This patch proposes that array be divided into
sets of adjacent devices and when the stripe copies are shifted, they wrap
on set boundaries rather than the array size boundary. That is, for the
purposes of shifting, the copies are confined to their sets within the
array. The sets are 'near_copies * far_copies' in size.
The above "far" algorithm example would change to:
"far" algorithm
dev1 dev2 dev3 dev4 dev5 dev6
==== ==== ==== ==== ==== ====
A B C D E F
G H I J K L
...
B A D C F E --> Copy of stripe0, shifted 1, 2-dev sets
H G J I L K Dev sets are 1-2, 3-4, 5-6
...
This has the affect of improving the redundancy of the array. We can
always sustain at least one failure, but sometimes more than one can
be handled. In the first examples, the pairs of devices that CANNOT fail
together are:
(1,2) (2,3) (3,4) (4,5) (5,6) (1, 6) [40% of possible pairs]
In the example where the copies are confined to sets, the pairs of
devices that cannot fail together are:
(1,2) (3,4) (5,6) [20% of possible pairs]
We cannot simply replace the old algorithms, so the 17th bit of the 'layout'
variable is used to indicate whether we use the old or new method of computing
the shift. (This is similar to the way the 16th bit indicates whether the
"far" algorithm or the "offset" algorithm is being used.)
This patch only handles the cases where the number of total raid disks is
a multiple of 'far_copies'. A follow-on patch addresses the condition where
this is not true.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-02-21 03:28:10 +01:00
|
|
|
int far_set_size; /* The number of devices in a set,
|
|
|
|
* where a 'set' are devices that
|
|
|
|
* contain far/offset copies of
|
|
|
|
* each other.
|
|
|
|
*/
|
2012-05-21 01:28:20 +02:00
|
|
|
int chunk_shift; /* shift from chunks to sectors */
|
|
|
|
sector_t chunk_mask;
|
2012-05-21 01:28:33 +02:00
|
|
|
} prev, geo;
|
2012-05-21 01:28:20 +02:00
|
|
|
int copies; /* near_copies * far_copies.
|
|
|
|
* must be <= raid_disks
|
|
|
|
*/
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2011-12-23 00:17:54 +01:00
|
|
|
sector_t dev_sectors; /* temp copy of
|
|
|
|
* mddev->dev_sectors */
|
2012-05-21 01:28:33 +02:00
|
|
|
sector_t reshape_progress;
|
2012-05-22 05:53:47 +02:00
|
|
|
sector_t reshape_safe;
|
|
|
|
unsigned long reshape_checkpoint;
|
|
|
|
sector_t offset_diff;
|
2010-03-08 06:02:45 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
struct list_head retry_list;
|
2015-08-14 03:26:17 +02:00
|
|
|
/* A separate list of r1bio which just need raid_end_bio_io called.
|
|
|
|
* This mustn't happen for writes which had any errors if the superblock
|
|
|
|
* needs to be written.
|
|
|
|
*/
|
|
|
|
struct list_head bio_end_io_list;
|
|
|
|
|
2006-01-06 09:20:16 +01:00
|
|
|
/* queue pending writes and submit them on unplug */
|
|
|
|
struct bio_list pending_bio_list;
|
2011-10-11 07:50:01 +02:00
|
|
|
int pending_count;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
spinlock_t resync_lock;
|
2016-06-24 14:20:16 +02:00
|
|
|
atomic_t nr_pending;
|
2011-12-23 00:17:54 +01:00
|
|
|
int nr_waiting;
|
|
|
|
int nr_queued;
|
|
|
|
int barrier;
|
2016-06-24 14:20:16 +02:00
|
|
|
int array_freeze_pending;
|
2005-04-17 00:20:36 +02:00
|
|
|
sector_t next_resync;
|
2006-01-06 09:20:16 +01:00
|
|
|
int fullsync; /* set to 1 if a full sync is needed,
|
|
|
|
* (fresh device added).
|
|
|
|
* Cleared when a sync completes.
|
|
|
|
*/
|
2011-12-23 00:17:54 +01:00
|
|
|
int have_replacement; /* There is at least one
|
|
|
|
* replacement device.
|
|
|
|
*/
|
2006-01-06 09:20:13 +01:00
|
|
|
wait_queue_head_t wait_barrier;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2018-05-21 00:25:52 +02:00
|
|
|
mempool_t r10bio_pool;
|
|
|
|
mempool_t r10buf_pool;
|
2006-01-06 09:20:28 +01:00
|
|
|
struct page *tmppage;
|
2018-05-21 00:25:52 +02:00
|
|
|
struct bio_set bio_split;
|
2010-03-08 06:02:45 +01:00
|
|
|
|
|
|
|
/* When taking over an array from a different personality, we store
|
|
|
|
* the new thread here until we fully activate the array.
|
|
|
|
*/
|
2011-10-11 07:48:23 +02:00
|
|
|
struct md_thread *thread;
|
2017-10-24 09:11:52 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Keep track of cluster resync window to send to other nodes.
|
|
|
|
*/
|
|
|
|
sector_t cluster_sync_low;
|
|
|
|
sector_t cluster_sync_high;
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* this is our 'private' RAID10 bio.
|
|
|
|
*
|
|
|
|
* it contains information about what kind of IO operations were started
|
|
|
|
* for this RAID10 operation, and about their status:
|
|
|
|
*/
|
|
|
|
|
2011-10-11 07:48:43 +02:00
|
|
|
struct r10bio {
|
2005-04-17 00:20:36 +02:00
|
|
|
atomic_t remaining; /* 'have we finished' count,
|
|
|
|
* used from IRQ handlers
|
|
|
|
*/
|
|
|
|
sector_t sector; /* virtual sector number */
|
|
|
|
int sectors;
|
|
|
|
unsigned long state;
|
2011-10-11 07:47:53 +02:00
|
|
|
struct mddev *mddev;
|
2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* original bio going to /dev/mdx
|
|
|
|
*/
|
|
|
|
struct bio *master_bio;
|
|
|
|
/*
|
|
|
|
* if the IO is in READ direction, then this is where we read
|
|
|
|
*/
|
|
|
|
int read_slot;
|
|
|
|
|
|
|
|
struct list_head retry_list;
|
|
|
|
/*
|
|
|
|
* if the IO is in WRITE direction, then multiple bios are used,
|
|
|
|
* one for each copy.
|
|
|
|
* When resyncing we also use one for each copy.
|
|
|
|
* When reconstructing, we use 2 bios, one for read, one for write.
|
|
|
|
* We choose the number when they are allocated.
|
2011-12-23 00:17:54 +01:00
|
|
|
* We sometimes need an extra bio to write to the replacement.
|
2005-04-17 00:20:36 +02:00
|
|
|
*/
|
2012-08-18 01:51:42 +02:00
|
|
|
struct r10dev {
|
2011-12-23 00:17:54 +01:00
|
|
|
struct bio *bio;
|
|
|
|
union {
|
|
|
|
struct bio *repl_bio; /* used for resync and
|
|
|
|
* writes */
|
|
|
|
struct md_rdev *rdev; /* used for reads
|
|
|
|
* (read_slot >= 0) */
|
|
|
|
};
|
|
|
|
sector_t addr;
|
|
|
|
int devnum;
|
2005-04-17 00:20:36 +02:00
|
|
|
} devs[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* bits for r10bio.state */
|
2011-12-23 00:17:54 +01:00
|
|
|
enum r10bio_state {
|
|
|
|
R10BIO_Uptodate,
|
|
|
|
R10BIO_IsSync,
|
|
|
|
R10BIO_IsRecover,
|
2012-05-22 05:53:47 +02:00
|
|
|
R10BIO_IsReshape,
|
2011-12-23 00:17:54 +01:00
|
|
|
R10BIO_Degraded,
|
2011-07-28 03:39:23 +02:00
|
|
|
/* Set ReadError on bios that experience a read error
|
|
|
|
* so that raid10d knows what to do with them.
|
|
|
|
*/
|
2011-12-23 00:17:54 +01:00
|
|
|
R10BIO_ReadError,
|
2011-07-28 03:39:24 +02:00
|
|
|
/* If a write for this request means we can clear some
|
|
|
|
* known-bad-block records, we set this flag.
|
|
|
|
*/
|
2011-12-23 00:17:54 +01:00
|
|
|
R10BIO_MadeGood,
|
|
|
|
R10BIO_WriteError,
|
2012-05-21 01:28:33 +02:00
|
|
|
/* During a reshape we might be performing IO on the
|
|
|
|
* 'previous' part of the array, in which case this
|
|
|
|
* flag is set
|
|
|
|
*/
|
|
|
|
R10BIO_Previous,
|
2016-11-18 06:16:12 +01:00
|
|
|
/* failfast devices did receive failfast requests. */
|
|
|
|
R10BIO_FailFast,
|
2011-12-23 00:17:54 +01:00
|
|
|
};
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|