Skip to content

Commit f87c50c

Browse files
committed
fix apfs
1 parent a7d0ca6 commit f87c50c

File tree

1 file changed

+50
-16
lines changed

1 file changed

+50
-16
lines changed

8001-Add-APFS-driver.patch

+50-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
From 55d1a7c4fd8cf68c22bc5bdd4870b85bd4d146a8 Mon Sep 17 00:00:00 2001
1+
From c1e8adec9607df9df5e01f208e01472e8ae14850 Mon Sep 17 00:00:00 2001
22
From: "github-actions[bot]"
33
<41898282+github-actions[bot]@users.noreply.github.com>
44
Date: Sat, 12 Apr 2025 18:45:24 +0000
55
Subject: [PATCH] Add APFS driver
66

77
---
88
fs/apfs/Makefile | 28 +
9-
fs/apfs/apfs.h | 1294 ++++++++++++
9+
fs/apfs/apfs.h | 1307 ++++++++++++
1010
fs/apfs/apfs_raw.h | 1570 ++++++++++++++
1111
fs/apfs/btree.c | 1174 +++++++++++
1212
fs/apfs/compress.c | 474 +++++
13-
fs/apfs/dir.c | 1497 ++++++++++++++
13+
fs/apfs/dir.c | 1504 ++++++++++++++
1414
fs/apfs/extents.c | 2374 ++++++++++++++++++++++
15-
fs/apfs/file.c | 213 ++
16-
fs/apfs/inode.c | 2571 +++++++++++++++++++++++
15+
fs/apfs/file.c | 220 ++
16+
fs/apfs/inode.c | 2578 +++++++++++++++++++++++
1717
fs/apfs/key.c | 337 +++
1818
fs/apfs/libzbitmap.c | 442 ++++
1919
fs/apfs/libzbitmap.h | 31 +
@@ -39,7 +39,7 @@ Subject: [PATCH] Add APFS driver
3939
fs/apfs/version.h | 1 +
4040
fs/apfs/xattr.c | 914 +++++++++
4141
fs/apfs/xfield.c | 171 ++
42-
34 files changed, 26817 insertions(+)
42+
34 files changed, 26851 insertions(+)
4343
create mode 100644 fs/apfs/Makefile
4444
create mode 100644 fs/apfs/apfs.h
4545
create mode 100644 fs/apfs/apfs_raw.h
@@ -111,10 +111,10 @@ index 000000000..a2dbed980
111111
+ make -C $(KERNEL_DIR) M=$(PWD) clean
112112
diff --git a/fs/apfs/apfs.h b/fs/apfs/apfs.h
113113
new file mode 100644
114-
index 000000000..9a1c4baa2
114+
index 000000000..5da9bf3c7
115115
--- /dev/null
116116
+++ b/fs/apfs/apfs.h
117-
@@ -0,0 +1,1294 @@
117+
@@ -0,0 +1,1307 @@
118118
+/* SPDX-License-Identifier: GPL-2.0-only */
119119
+/*
120120
+ * Copyright (C) 2018 Ernesto A. Fernández <[email protected]>
@@ -1072,7 +1072,7 @@ index 000000000..9a1c4baa2
10721072
+ struct dentry *new_dentry, unsigned int flags);
10731073
+extern int apfs_create(struct user_namespace *mnt_userns, struct inode *dir,
10741074
+ struct dentry *dentry, umode_t mode, bool excl);
1075-
+#else
1075+
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 15, 0)
10761076
+extern int apfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
10771077
+ struct dentry *dentry, umode_t mode, dev_t rdev);
10781078
+extern int apfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
@@ -1082,6 +1082,15 @@ index 000000000..9a1c4baa2
10821082
+ struct dentry *new_dentry, unsigned int flags);
10831083
+extern int apfs_create(struct mnt_idmap *idmap, struct inode *dir,
10841084
+ struct dentry *dentry, umode_t mode, bool excl);
1085+
+#else
1086+
+extern int apfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
1087+
+ struct dentry *dentry, umode_t mode, dev_t rdev);
1088+
+extern struct dentry *apfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode);
1089+
+extern int apfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
1090+
+ struct dentry *old_dentry, struct inode *new_dir,
1091+
+ struct dentry *new_dentry, unsigned int flags);
1092+
+extern int apfs_create(struct mnt_idmap *idmap, struct inode *dir,
1093+
+ struct dentry *dentry, umode_t mode, bool excl);
10851094
+#endif
10861095
+
10871096
+extern int apfs_link(struct dentry *old_dentry, struct inode *dir,
@@ -1311,6 +1320,10 @@ index 000000000..9a1c4baa2
13111320
+ ASSERT(apfs_node_is_root(apfs_query_root(query)));
13121321
+}
13131322
+
1323+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
1324+
+#define page_has_buffers(page) folio_buffers(page_folio(page))
1325+
+#endif
1326+
+
13141327
+/*
13151328
+ * TODO: the following are modified variants of buffer head functions that will
13161329
+ * work with the shared block device for the container. The correct approach
@@ -4647,10 +4660,10 @@ index 000000000..ecdd490ab
46474660
+}
46484661
diff --git a/fs/apfs/dir.c b/fs/apfs/dir.c
46494662
new file mode 100644
4650-
index 000000000..25797aa1e
4663+
index 000000000..ce6582608
46514664
--- /dev/null
46524665
+++ b/fs/apfs/dir.c
4653-
@@ -0,0 +1,1497 @@
4666+
@@ -0,0 +1,1504 @@
46544667
+// SPDX-License-Identifier: GPL-2.0-only
46554668
+/*
46564669
+ * Copyright (C) 2018 Ernesto A. Fernández <[email protected]>
@@ -5377,14 +5390,21 @@ index 000000000..25797aa1e
53775390
+ return apfs_mknod(mnt_userns, dir, dentry, mode | S_IFDIR, 0 /* rdev */);
53785391
+}
53795392
+
5380-
+#else
5393+
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 15, 0)
53815394
+
53825395
+int apfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
53835396
+ struct dentry *dentry, umode_t mode)
53845397
+{
53855398
+ return apfs_mknod(idmap, dir, dentry, mode | S_IFDIR, 0 /* rdev */);
53865399
+}
53875400
+
5401+
+#else
5402+
+
5403+
+struct dentry *apfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode)
5404+
+{
5405+
+ return ERR_PTR(apfs_mknod(idmap, dir, dentry, mode | S_IFDIR, 0 /* rdev */));
5406+
+}
5407+
+
53885408
+#endif
53895409
+
53905410
+
@@ -8530,10 +8550,10 @@ index 000000000..fabb2d230
85308550
+}
85318551
diff --git a/fs/apfs/file.c b/fs/apfs/file.c
85328552
new file mode 100644
8533-
index 000000000..3d0923fa6
8553+
index 000000000..6c411aaf3
85348554
--- /dev/null
85358555
+++ b/fs/apfs/file.c
8536-
@@ -0,0 +1,213 @@
8556+
@@ -0,0 +1,220 @@
85378557
+// SPDX-License-Identifier: GPL-2.0-only
85388558
+/*
85398559
+ * Copyright (C) 2018 Ernesto A. Fernández <[email protected]>
@@ -8548,6 +8568,13 @@ index 000000000..3d0923fa6
85488568
+typedef int vm_fault_t;
85498569
+#endif
85508570
+
8571+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
8572+
+static void wait_for_stable_page(struct page *page)
8573+
+{
8574+
+ return folio_wait_stable(page_folio(page));
8575+
+}
8576+
+#endif
8577+
+
85518578
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
85528579
+static vm_fault_t apfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
85538580
+{
@@ -8749,10 +8776,10 @@ index 000000000..3d0923fa6
87498776
+};
87508777
diff --git a/fs/apfs/inode.c b/fs/apfs/inode.c
87518778
new file mode 100644
8752-
index 000000000..6418f994d
8779+
index 000000000..3f67b7a82
87538780
--- /dev/null
87548781
+++ b/fs/apfs/inode.c
8755-
@@ -0,0 +1,2571 @@
8782+
@@ -0,0 +1,2578 @@
87568783
+// SPDX-License-Identifier: GPL-2.0-only
87578784
+/*
87588785
+ * Copyright (C) 2018 Ernesto A. Fernández <[email protected]>
@@ -8775,6 +8802,13 @@ index 000000000..6418f994d
87758802
+
87768803
+#define MAX_PFK_LEN 512
87778804
+
8805+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
8806+
+static struct page *grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index)
8807+
+{
8808+
+ return pagecache_get_page(mapping, index, FGP_WRITEBEGIN, mapping_gfp_mask(mapping));
8809+
+}
8810+
+#endif
8811+
+
87788812
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || RHEL_VERSION_GE(9, 3)
87798813
+
87808814
+static int apfs_read_folio(struct file *file, struct folio *folio)

0 commit comments

Comments
 (0)