1
- From 55d1a7c4fd8cf68c22bc5bdd4870b85bd4d146a8 Mon Sep 17 00:00:00 2001
1
+ From c1e8adec9607df9df5e01f208e01472e8ae14850 Mon Sep 17 00:00:00 2001
2
2
From: "github-actions[bot]"
3
3
<41898282+github-actions[bot]@users.noreply.github.com>
4
4
Date: Sat, 12 Apr 2025 18:45:24 +0000
5
5
Subject: [PATCH] Add APFS driver
6
6
7
7
---
8
8
fs/apfs/Makefile | 28 +
9
- fs/apfs/apfs.h | 1294 ++++++++++++
9
+ fs/apfs/apfs.h | 1307 ++++++++++++
10
10
fs/apfs/apfs_raw.h | 1570 ++++++++++++++
11
11
fs/apfs/btree.c | 1174 +++++++++++
12
12
fs/apfs/compress.c | 474 +++++
13
- fs/apfs/dir.c | 1497 ++++++++++++++
13
+ fs/apfs/dir.c | 1504 ++++++++++++++
14
14
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 +++++++++++++++++++++++
17
17
fs/apfs/key.c | 337 +++
18
18
fs/apfs/libzbitmap.c | 442 ++++
19
19
fs/apfs/libzbitmap.h | 31 +
@@ -39,7 +39,7 @@ Subject: [PATCH] Add APFS driver
39
39
fs/apfs/version.h | 1 +
40
40
fs/apfs/xattr.c | 914 +++++++++
41
41
fs/apfs/xfield.c | 171 ++
42
- 34 files changed, 26817 insertions(+)
42
+ 34 files changed, 26851 insertions(+)
43
43
create mode 100644 fs/apfs/Makefile
44
44
create mode 100644 fs/apfs/apfs.h
45
45
create mode 100644 fs/apfs/apfs_raw.h
@@ -111,10 +111,10 @@ index 000000000..a2dbed980
111
111
+ make -C $(KERNEL_DIR) M=$(PWD) clean
112
112
diff --git a/fs/apfs/apfs.h b/fs/apfs/apfs.h
113
113
new file mode 100644
114
- index 000000000..9a1c4baa2
114
+ index 000000000..5da9bf3c7
115
115
--- /dev/null
116
116
+++ b/fs/apfs/apfs.h
117
- @@ -0,0 +1,1294 @@
117
+ @@ -0,0 +1,1307 @@
118
118
+/* SPDX-License-Identifier: GPL-2.0-only */
119
119
+/*
120
120
+ * Copyright (C) 2018 Ernesto A. Fernández <
[email protected] >
@@ -1072,7 +1072,7 @@ index 000000000..9a1c4baa2
1072
1072
+ struct dentry *new_dentry, unsigned int flags);
1073
1073
+extern int apfs_create(struct user_namespace *mnt_userns, struct inode *dir,
1074
1074
+ struct dentry *dentry, umode_t mode, bool excl);
1075
- +#else
1075
+ +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 15, 0)
1076
1076
+extern int apfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
1077
1077
+ struct dentry *dentry, umode_t mode, dev_t rdev);
1078
1078
+extern int apfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
@@ -1082,6 +1082,15 @@ index 000000000..9a1c4baa2
1082
1082
+ struct dentry *new_dentry, unsigned int flags);
1083
1083
+extern int apfs_create(struct mnt_idmap *idmap, struct inode *dir,
1084
1084
+ 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);
1085
1094
+#endif
1086
1095
+
1087
1096
+extern int apfs_link(struct dentry *old_dentry, struct inode *dir,
@@ -1311,6 +1320,10 @@ index 000000000..9a1c4baa2
1311
1320
+ ASSERT(apfs_node_is_root(apfs_query_root(query)));
1312
1321
+}
1313
1322
+
1323
+ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
1324
+ +#define page_has_buffers(page) folio_buffers(page_folio(page))
1325
+ +#endif
1326
+ +
1314
1327
+/*
1315
1328
+ * TODO: the following are modified variants of buffer head functions that will
1316
1329
+ * work with the shared block device for the container. The correct approach
@@ -4647,10 +4660,10 @@ index 000000000..ecdd490ab
4647
4660
+}
4648
4661
diff --git a/fs/apfs/dir.c b/fs/apfs/dir.c
4649
4662
new file mode 100644
4650
- index 000000000..25797aa1e
4663
+ index 000000000..ce6582608
4651
4664
--- /dev/null
4652
4665
+++ b/fs/apfs/dir.c
4653
- @@ -0,0 +1,1497 @@
4666
+ @@ -0,0 +1,1504 @@
4654
4667
+// SPDX-License-Identifier: GPL-2.0-only
4655
4668
+/*
4656
4669
+ * Copyright (C) 2018 Ernesto A. Fernández <
[email protected] >
@@ -5377,14 +5390,21 @@ index 000000000..25797aa1e
5377
5390
+ return apfs_mknod(mnt_userns, dir, dentry, mode | S_IFDIR, 0 /* rdev */);
5378
5391
+}
5379
5392
+
5380
- +#else
5393
+ +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 15, 0)
5381
5394
+
5382
5395
+int apfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
5383
5396
+ struct dentry *dentry, umode_t mode)
5384
5397
+{
5385
5398
+ return apfs_mknod(idmap, dir, dentry, mode | S_IFDIR, 0 /* rdev */);
5386
5399
+}
5387
5400
+
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
+ +
5388
5408
+#endif
5389
5409
+
5390
5410
+
@@ -8530,10 +8550,10 @@ index 000000000..fabb2d230
8530
8550
+}
8531
8551
diff --git a/fs/apfs/file.c b/fs/apfs/file.c
8532
8552
new file mode 100644
8533
- index 000000000..3d0923fa6
8553
+ index 000000000..6c411aaf3
8534
8554
--- /dev/null
8535
8555
+++ b/fs/apfs/file.c
8536
- @@ -0,0 +1,213 @@
8556
+ @@ -0,0 +1,220 @@
8537
8557
+// SPDX-License-Identifier: GPL-2.0-only
8538
8558
+/*
8539
8559
+ * Copyright (C) 2018 Ernesto A. Fernández <
[email protected] >
@@ -8548,6 +8568,13 @@ index 000000000..3d0923fa6
8548
8568
+typedef int vm_fault_t;
8549
8569
+#endif
8550
8570
+
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
+ +
8551
8578
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
8552
8579
+static vm_fault_t apfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
8553
8580
+{
@@ -8749,10 +8776,10 @@ index 000000000..3d0923fa6
8749
8776
+};
8750
8777
diff --git a/fs/apfs/inode.c b/fs/apfs/inode.c
8751
8778
new file mode 100644
8752
- index 000000000..6418f994d
8779
+ index 000000000..3f67b7a82
8753
8780
--- /dev/null
8754
8781
+++ b/fs/apfs/inode.c
8755
- @@ -0,0 +1,2571 @@
8782
+ @@ -0,0 +1,2578 @@
8756
8783
+// SPDX-License-Identifier: GPL-2.0-only
8757
8784
+/*
8758
8785
+ * Copyright (C) 2018 Ernesto A. Fernández <
[email protected] >
@@ -8775,6 +8802,13 @@ index 000000000..6418f994d
8775
8802
+
8776
8803
+#define MAX_PFK_LEN 512
8777
8804
+
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
+ +
8778
8812
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || RHEL_VERSION_GE(9, 3)
8779
8813
+
8780
8814
+static int apfs_read_folio(struct file *file, struct folio *folio)
0 commit comments