hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/ntfs/mft.c
....@@ -1,23 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /**
23 * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project.
34 *
45 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
56 * Copyright (c) 2002 Richard Russon
6
- *
7
- * This program/include file is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License as published
9
- * by the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program/include file is distributed in the hope that it will be
13
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program (in the main directory of the Linux-NTFS
19
- * distribution in the file COPYING); if not, write to the Free Software
20
- * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
217 */
228
239 #include <linux/buffer_head.h>
....@@ -85,7 +71,7 @@
8571 }
8672 /* Read, map, and pin the page. */
8773 page = ntfs_map_page(mft_vi->i_mapping, index);
88
- if (likely(!IS_ERR(page))) {
74
+ if (!IS_ERR(page)) {
8975 /* Catch multi sector transfer fixup errors. */
9076 if (likely(ntfs_is_mft_recordp((le32*)(page_address(page) +
9177 ofs)))) {
....@@ -168,7 +154,7 @@
168154 mutex_lock(&ni->mrec_lock);
169155
170156 m = map_mft_record_page(ni);
171
- if (likely(!IS_ERR(m)))
157
+ if (!IS_ERR(m))
172158 return m;
173159
174160 mutex_unlock(&ni->mrec_lock);
....@@ -285,7 +271,7 @@
285271 m = map_mft_record(ni);
286272 /* map_mft_record() has incremented this on success. */
287273 atomic_dec(&ni->count);
288
- if (likely(!IS_ERR(m))) {
274
+ if (!IS_ERR(m)) {
289275 /* Verify the sequence number. */
290276 if (likely(le16_to_cpu(m->sequence_number) == seq_no)) {
291277 ntfs_debug("Done 1.");
....@@ -518,7 +504,7 @@
518504 bh = bh->b_this_page;
519505 } while (bh);
520506 tail->b_this_page = head;
521
- attach_page_buffers(page, head);
507
+ attach_page_private(page, head);
522508 }
523509 bh = head = page_buffers(page);
524510 BUG_ON(!bh);
....@@ -972,7 +958,7 @@
972958 * dirty code path of the inode dirty code path when writing
973959 * $MFT occurs.
974960 */
975
- vi = ilookup5_nowait(sb, mft_no, (test_t)ntfs_test_inode, &na);
961
+ vi = ilookup5_nowait(sb, mft_no, ntfs_test_inode, &na);
976962 }
977963 if (vi) {
978964 ntfs_debug("Base inode 0x%lx is in icache.", mft_no);
....@@ -1033,7 +1019,7 @@
10331019 vi = igrab(mft_vi);
10341020 BUG_ON(vi != mft_vi);
10351021 } else
1036
- vi = ilookup5_nowait(sb, na.mft_no, (test_t)ntfs_test_inode,
1022
+ vi = ilookup5_nowait(sb, na.mft_no, ntfs_test_inode,
10371023 &na);
10381024 if (!vi) {
10391025 /*
....@@ -1317,7 +1303,7 @@
13171303 read_unlock_irqrestore(&mftbmp_ni->size_lock, flags);
13181304 rl = ntfs_attr_find_vcn_nolock(mftbmp_ni,
13191305 (ll - 1) >> vol->cluster_size_bits, NULL);
1320
- if (unlikely(IS_ERR(rl) || !rl->length || rl->lcn < 0)) {
1306
+ if (IS_ERR(rl) || unlikely(!rl->length || rl->lcn < 0)) {
13211307 up_write(&mftbmp_ni->runlist.lock);
13221308 ntfs_error(vol->sb, "Failed to determine last allocated "
13231309 "cluster of mft bitmap attribute.");
....@@ -1748,7 +1734,7 @@
17481734 read_unlock_irqrestore(&mft_ni->size_lock, flags);
17491735 rl = ntfs_attr_find_vcn_nolock(mft_ni,
17501736 (ll - 1) >> vol->cluster_size_bits, NULL);
1751
- if (unlikely(IS_ERR(rl) || !rl->length || rl->lcn < 0)) {
1737
+ if (IS_ERR(rl) || unlikely(!rl->length || rl->lcn < 0)) {
17521738 up_write(&mft_ni->runlist.lock);
17531739 ntfs_error(vol->sb, "Failed to determine last allocated "
17541740 "cluster of mft data attribute.");
....@@ -1790,7 +1776,7 @@
17901776 do {
17911777 rl2 = ntfs_cluster_alloc(vol, old_last_vcn, nr, lcn, MFT_ZONE,
17921778 true);
1793
- if (likely(!IS_ERR(rl2)))
1779
+ if (!IS_ERR(rl2))
17941780 break;
17951781 if (PTR_ERR(rl2) != -ENOSPC || nr == min_nr) {
17961782 ntfs_error(vol->sb, "Failed to allocate the minimal "