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 14:07:57 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-02-16 00:49:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Christoph Hellwig.
|
|
|
|
*/
|
|
|
|
#include "xfs.h"
|
2019-06-29 02:25:35 +00:00
|
|
|
#include "xfs_shared.h"
|
2015-02-16 00:49:23 +00:00
|
|
|
#include "xfs_format.h"
|
|
|
|
#include "xfs_log_format.h"
|
|
|
|
#include "xfs_trans_resv.h"
|
|
|
|
#include "xfs_mount.h"
|
|
|
|
#include "xfs_inode.h"
|
|
|
|
#include "xfs_trans.h"
|
|
|
|
#include "xfs_bmap.h"
|
|
|
|
#include "xfs_iomap.h"
|
2019-10-22 16:53:50 +00:00
|
|
|
#include "xfs_pnfs.h"
|
2015-02-16 00:49:23 +00:00
|
|
|
|
2015-02-16 00:59:50 +00:00
|
|
|
/*
|
|
|
|
* Ensure that we do not have any outstanding pNFS layouts that can be used by
|
|
|
|
* clients to directly read from or write to this inode. This must be called
|
|
|
|
* before every operation that can remove blocks from the extent map.
|
|
|
|
* Additionally we call it during the write operation, where aren't concerned
|
|
|
|
* about exposing unallocated blocks but just want to provide basic
|
|
|
|
* synchronization between a local writer and pNFS clients. mmap writes would
|
|
|
|
* also benefit from this sort of synchronization, but due to the tricky locking
|
|
|
|
* rules in the page fault path we don't bother.
|
|
|
|
*/
|
|
|
|
int
|
2018-03-20 21:42:38 +00:00
|
|
|
xfs_break_leased_layouts(
|
2015-02-16 00:59:50 +00:00
|
|
|
struct inode *inode,
|
2018-03-20 21:42:38 +00:00
|
|
|
uint *iolock,
|
|
|
|
bool *did_unlock)
|
2015-02-16 00:59:50 +00:00
|
|
|
{
|
|
|
|
struct xfs_inode *ip = XFS_I(inode);
|
|
|
|
int error;
|
|
|
|
|
2019-08-20 01:15:28 +00:00
|
|
|
while ((error = break_layout(inode, false)) == -EWOULDBLOCK) {
|
2015-02-16 00:59:50 +00:00
|
|
|
xfs_iunlock(ip, *iolock);
|
2018-03-20 21:42:38 +00:00
|
|
|
*did_unlock = true;
|
2015-02-16 00:59:50 +00:00
|
|
|
error = break_layout(inode, true);
|
2018-03-12 21:12:29 +00:00
|
|
|
*iolock &= ~XFS_IOLOCK_SHARED;
|
|
|
|
*iolock |= XFS_IOLOCK_EXCL;
|
2015-02-16 00:59:50 +00:00
|
|
|
xfs_ilock(ip, *iolock);
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2015-02-16 00:49:23 +00:00
|
|
|
/*
|
|
|
|
* Get a unique ID including its location so that the client can identify
|
|
|
|
* the exported device.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
xfs_fs_get_uuid(
|
|
|
|
struct super_block *sb,
|
|
|
|
u8 *buf,
|
|
|
|
u32 *len,
|
|
|
|
u64 *offset)
|
|
|
|
{
|
|
|
|
struct xfs_mount *mp = XFS_M(sb);
|
|
|
|
|
2024-11-04 04:18:49 +00:00
|
|
|
xfs_warn_experimental(mp, XFS_EXPERIMENTAL_PNFS);
|
2015-02-16 00:49:23 +00:00
|
|
|
|
|
|
|
if (*len < sizeof(uuid_t))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
memcpy(buf, &mp->m_sb.sb_uuid, sizeof(uuid_t));
|
|
|
|
*len = sizeof(uuid_t);
|
|
|
|
*offset = offsetof(struct xfs_dsb, sb_uuid);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-01-31 21:20:10 +00:00
|
|
|
/*
|
|
|
|
* We cannot use file based VFS helpers such as file_modified() to update
|
|
|
|
* inode state as we modify the data/metadata in the inode here. Hence we have
|
|
|
|
* to open code the timestamp updates and SUID/SGID stripping. We also need
|
|
|
|
* to set the inode prealloc flag to ensure that the extents we allocate are not
|
|
|
|
* removed if the inode is reclaimed from memory before xfs_fs_block_commit()
|
|
|
|
* is from the client to indicate that data has been written and the file size
|
|
|
|
* can be extended.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
xfs_fs_map_update_inode(
|
|
|
|
struct xfs_inode *ip)
|
|
|
|
{
|
|
|
|
struct xfs_trans *tp;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
error = xfs_trans_alloc(ip->i_mount, &M_RES(ip->i_mount)->tr_writeid,
|
|
|
|
0, 0, 0, &tp);
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
|
|
|
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
|
|
|
|
|
|
|
|
VFS_I(ip)->i_mode &= ~S_ISUID;
|
|
|
|
if (VFS_I(ip)->i_mode & S_IXGRP)
|
|
|
|
VFS_I(ip)->i_mode &= ~S_ISGID;
|
|
|
|
xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
|
|
|
|
ip->i_diflags |= XFS_DIFLAG_PREALLOC;
|
|
|
|
|
|
|
|
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
|
|
|
|
return xfs_trans_commit(tp);
|
|
|
|
}
|
|
|
|
|
2015-02-16 00:49:23 +00:00
|
|
|
/*
|
|
|
|
* Get a layout for the pNFS client.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
xfs_fs_map_blocks(
|
|
|
|
struct inode *inode,
|
|
|
|
loff_t offset,
|
|
|
|
u64 length,
|
|
|
|
struct iomap *iomap,
|
|
|
|
bool write,
|
|
|
|
u32 *device_generation)
|
|
|
|
{
|
|
|
|
struct xfs_inode *ip = XFS_I(inode);
|
|
|
|
struct xfs_mount *mp = ip->i_mount;
|
|
|
|
struct xfs_bmbt_irec imap;
|
|
|
|
xfs_fileoff_t offset_fsb, end_fsb;
|
|
|
|
loff_t limit;
|
|
|
|
int bmapi_flags = XFS_BMAPI_ENTIRE;
|
|
|
|
int nimaps = 1;
|
|
|
|
uint lock_flags;
|
|
|
|
int error = 0;
|
2022-11-28 22:09:17 +00:00
|
|
|
u64 seq;
|
2015-02-16 00:49:23 +00:00
|
|
|
|
2021-08-19 01:46:53 +00:00
|
|
|
if (xfs_is_shutdown(mp))
|
2015-02-16 00:49:23 +00:00
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We can't export inodes residing on the realtime device. The realtime
|
|
|
|
* device doesn't have a UUID to identify it, so the client has no way
|
|
|
|
* to find it.
|
|
|
|
*/
|
|
|
|
if (XFS_IS_REALTIME_INODE(ip))
|
|
|
|
return -ENXIO;
|
|
|
|
|
2016-10-03 16:11:16 +00:00
|
|
|
/*
|
|
|
|
* The pNFS block layout spec actually supports reflink like
|
|
|
|
* functionality, but the Linux pNFS server doesn't implement it yet.
|
|
|
|
*/
|
|
|
|
if (xfs_is_reflink_inode(ip))
|
|
|
|
return -ENXIO;
|
|
|
|
|
2015-02-16 00:49:23 +00:00
|
|
|
/*
|
|
|
|
* Lock out any other I/O before we flush and invalidate the pagecache,
|
|
|
|
* and then hand out a layout to the remote system. This is very
|
|
|
|
* similar to direct I/O, except that the synchronization is much more
|
2018-03-20 21:42:38 +00:00
|
|
|
* complicated. See the comment near xfs_break_leased_layouts
|
|
|
|
* for a detailed explanation.
|
2015-02-16 00:49:23 +00:00
|
|
|
*/
|
|
|
|
xfs_ilock(ip, XFS_IOLOCK_EXCL);
|
|
|
|
|
|
|
|
error = -EINVAL;
|
|
|
|
limit = mp->m_super->s_maxbytes;
|
|
|
|
if (!write)
|
|
|
|
limit = max(limit, round_up(i_size_read(inode),
|
|
|
|
inode->i_sb->s_blocksize));
|
|
|
|
if (offset > limit)
|
|
|
|
goto out_unlock;
|
|
|
|
if (offset > limit - length)
|
|
|
|
length = limit - offset;
|
|
|
|
|
|
|
|
error = filemap_write_and_wait(inode->i_mapping);
|
|
|
|
if (error)
|
|
|
|
goto out_unlock;
|
|
|
|
error = invalidate_inode_pages2(inode->i_mapping);
|
|
|
|
if (WARN_ON_ONCE(error))
|
2020-11-11 16:07:37 +00:00
|
|
|
goto out_unlock;
|
2015-02-16 00:49:23 +00:00
|
|
|
|
|
|
|
end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length);
|
|
|
|
offset_fsb = XFS_B_TO_FSBT(mp, offset);
|
|
|
|
|
|
|
|
lock_flags = xfs_ilock_data_map_shared(ip);
|
|
|
|
error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb,
|
|
|
|
&imap, &nimaps, bmapi_flags);
|
2022-11-28 22:09:17 +00:00
|
|
|
seq = xfs_iomap_inode_sequence(ip, 0);
|
2015-02-16 00:49:23 +00:00
|
|
|
|
2019-10-30 19:24:58 +00:00
|
|
|
ASSERT(!nimaps || imap.br_startblock != DELAYSTARTBLOCK);
|
|
|
|
|
2019-10-30 19:24:59 +00:00
|
|
|
if (!error && write &&
|
|
|
|
(!nimaps || imap.br_startblock == HOLESTARTBLOCK)) {
|
|
|
|
if (offset + length > XFS_ISIZE(ip))
|
|
|
|
end_fsb = xfs_iomap_eof_align_last_fsb(ip, end_fsb);
|
|
|
|
else if (nimaps && imap.br_startblock == HOLESTARTBLOCK)
|
|
|
|
end_fsb = min(end_fsb, imap.br_startoff +
|
|
|
|
imap.br_blockcount);
|
|
|
|
xfs_iunlock(ip, lock_flags);
|
|
|
|
|
|
|
|
error = xfs_iomap_write_direct(ip, offset_fsb,
|
2022-11-28 22:09:17 +00:00
|
|
|
end_fsb - offset_fsb, 0, &imap, &seq);
|
2019-10-30 19:24:58 +00:00
|
|
|
if (error)
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure the next transaction is committed synchronously so
|
|
|
|
* that the blocks allocated and handed out to the client are
|
|
|
|
* guaranteed to be present even after a server crash.
|
|
|
|
*/
|
2022-01-31 21:20:10 +00:00
|
|
|
error = xfs_fs_map_update_inode(ip);
|
2022-01-31 21:20:08 +00:00
|
|
|
if (!error)
|
|
|
|
error = xfs_log_force_inode(ip);
|
2015-02-16 00:49:23 +00:00
|
|
|
if (error)
|
|
|
|
goto out_unlock;
|
2022-01-31 21:20:08 +00:00
|
|
|
|
2019-10-30 19:24:59 +00:00
|
|
|
} else {
|
|
|
|
xfs_iunlock(ip, lock_flags);
|
2015-02-16 00:49:23 +00:00
|
|
|
}
|
|
|
|
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
|
|
|
|
|
2022-11-28 22:09:17 +00:00
|
|
|
error = xfs_bmbt_to_iomap(ip, iomap, &imap, 0, 0, seq);
|
2015-02-16 00:49:23 +00:00
|
|
|
*device_generation = mp->m_generation;
|
|
|
|
return error;
|
|
|
|
out_unlock:
|
|
|
|
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure the size update falls into a valid allocated block.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
xfs_pnfs_validate_isize(
|
|
|
|
struct xfs_inode *ip,
|
|
|
|
xfs_off_t isize)
|
|
|
|
{
|
|
|
|
struct xfs_bmbt_irec imap;
|
|
|
|
int nimaps = 1;
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
|
|
|
error = xfs_bmapi_read(ip, XFS_B_TO_FSBT(ip->i_mount, isize - 1), 1,
|
|
|
|
&imap, &nimaps, 0);
|
|
|
|
xfs_iunlock(ip, XFS_ILOCK_SHARED);
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
if (imap.br_startblock == HOLESTARTBLOCK ||
|
|
|
|
imap.br_startblock == DELAYSTARTBLOCK ||
|
|
|
|
imap.br_state == XFS_EXT_UNWRITTEN)
|
|
|
|
return -EIO;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure the blocks described by maps are stable on disk. This includes
|
|
|
|
* converting any unwritten extents, flushing the disk cache and updating the
|
|
|
|
* time stamps.
|
|
|
|
*
|
|
|
|
* Note that we rely on the caller to always send us a timestamp update so that
|
|
|
|
* we always commit a transaction here. If that stops being true we will have
|
|
|
|
* to manually flush the cache here similar to what the fsync code path does
|
|
|
|
* for datasyncs on files that have no dirty metadata.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
xfs_fs_commit_blocks(
|
|
|
|
struct inode *inode,
|
|
|
|
struct iomap *maps,
|
|
|
|
int nr_maps,
|
|
|
|
struct iattr *iattr)
|
|
|
|
{
|
|
|
|
struct xfs_inode *ip = XFS_I(inode);
|
|
|
|
struct xfs_mount *mp = ip->i_mount;
|
|
|
|
struct xfs_trans *tp;
|
|
|
|
bool update_isize = false;
|
|
|
|
int error, i;
|
|
|
|
loff_t size;
|
|
|
|
|
|
|
|
ASSERT(iattr->ia_valid & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME));
|
|
|
|
|
|
|
|
xfs_ilock(ip, XFS_IOLOCK_EXCL);
|
|
|
|
|
|
|
|
size = i_size_read(inode);
|
|
|
|
if ((iattr->ia_valid & ATTR_SIZE) && iattr->ia_size > size) {
|
|
|
|
update_isize = true;
|
|
|
|
size = iattr->ia_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < nr_maps; i++) {
|
|
|
|
u64 start, length, end;
|
|
|
|
|
|
|
|
start = maps[i].offset;
|
|
|
|
if (start > size)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
end = start + maps[i].length;
|
|
|
|
if (end > size)
|
|
|
|
end = size;
|
|
|
|
|
|
|
|
length = end - start;
|
|
|
|
if (!length)
|
|
|
|
continue;
|
2022-01-31 21:20:10 +00:00
|
|
|
|
2015-02-16 00:49:23 +00:00
|
|
|
/*
|
|
|
|
* Make sure reads through the pagecache see the new data.
|
|
|
|
*/
|
|
|
|
error = invalidate_inode_pages2_range(inode->i_mapping,
|
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
ago with promise that one day it will be possible to implement page
cache with bigger chunks than PAGE_SIZE.
This promise never materialized. And unlikely will.
We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE. And it's constant source of confusion on whether
PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
especially on the border between fs and mm.
Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.
Let's stop pretending that pages in page cache are special. They are
not.
The changes are pretty straight-forward:
- <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
- page_cache_get() -> get_page();
- page_cache_release() -> put_page();
This patch contains automated changes generated with coccinelle using
script below. For some reason, coccinelle doesn't patch header files.
I've called spatch for them manually.
The only adjustment after coccinelle is revert of changes to
PAGE_CAHCE_ALIGN definition: we are going to drop it later.
There are few places in the code where coccinelle didn't reach. I'll
fix them manually in a separate patch. Comments and documentation also
will be addressed with the separate patch.
virtual patch
@@
expression E;
@@
- E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
expression E;
@@
- E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
@@
- PAGE_CACHE_SHIFT
+ PAGE_SHIFT
@@
@@
- PAGE_CACHE_SIZE
+ PAGE_SIZE
@@
@@
- PAGE_CACHE_MASK
+ PAGE_MASK
@@
expression E;
@@
- PAGE_CACHE_ALIGN(E)
+ PAGE_ALIGN(E)
@@
expression E;
@@
- page_cache_get(E)
+ get_page(E)
@@
expression E;
@@
- page_cache_release(E)
+ put_page(E)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-04-01 12:29:47 +00:00
|
|
|
start >> PAGE_SHIFT,
|
|
|
|
(end - 1) >> PAGE_SHIFT);
|
2015-02-16 00:49:23 +00:00
|
|
|
WARN_ON_ONCE(error);
|
|
|
|
|
2017-09-21 18:26:18 +00:00
|
|
|
error = xfs_iomap_write_unwritten(ip, start, length, false);
|
2015-02-16 00:49:23 +00:00
|
|
|
if (error)
|
|
|
|
goto out_drop_iolock;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (update_isize) {
|
|
|
|
error = xfs_pnfs_validate_isize(ip, size);
|
|
|
|
if (error)
|
|
|
|
goto out_drop_iolock;
|
|
|
|
}
|
|
|
|
|
2016-04-05 23:19:55 +00:00
|
|
|
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
|
|
|
|
if (error)
|
2015-02-16 00:49:23 +00:00
|
|
|
goto out_drop_iolock;
|
|
|
|
|
|
|
|
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
|
|
|
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
|
|
|
|
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
|
|
|
|
|
2022-03-08 18:51:16 +00:00
|
|
|
ASSERT(!(iattr->ia_valid & (ATTR_UID | ATTR_GID)));
|
2023-01-13 11:49:11 +00:00
|
|
|
setattr_copy(&nop_mnt_idmap, inode, iattr);
|
2015-02-16 00:49:23 +00:00
|
|
|
if (update_isize) {
|
|
|
|
i_size_write(inode, iattr->ia_size);
|
2021-03-29 18:11:40 +00:00
|
|
|
ip->i_disk_size = iattr->ia_size;
|
2015-02-16 00:49:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xfs_trans_set_sync(tp);
|
2015-06-04 03:48:08 +00:00
|
|
|
error = xfs_trans_commit(tp);
|
2015-02-16 00:49:23 +00:00
|
|
|
|
|
|
|
out_drop_iolock:
|
|
|
|
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
|
|
|
|
return error;
|
|
|
|
}
|