Added 6.15-6.16 patches

Signed-off-by: shadichy <shadichy@blisslabs.org>
This commit is contained in:
shadichy 2025-11-02 04:44:21 +07:00
parent 54c457f898
commit d275a34510
No known key found for this signature in database
GPG key ID: EB6C21CD35431C3E
7 changed files with 388 additions and 13 deletions

View file

@ -1,6 +1,6 @@
pkgbase = ntfsplus-dkms-git
pkgdesc = A new NTFS driver for Linux promised to be better than NTFS3. These patches are directly taken from the maintainer's mailing list posts. Backported to 6.17.
pkgver = 2025.10.20.r28.1fa37cd35
pkgver = 2025.10.20.r32.d76784df4
pkgrel = 1
url = https://lore.kernel.org/all/20251020021227.5965-6-linkinjeon@kernel.org
arch = any
@ -13,13 +13,21 @@ pkgbase = ntfsplus-dkms-git
source = ntfsplus-00-05.mbox.gz::https://lore.kernel.org/all/20251020020749.5522-1-linkinjeon@kernel.org/t.mbox.gz
source = ntfsplus-06-11.mbox.gz::https://lore.kernel.org/all/20251020021227.5965-6-linkinjeon@kernel.org/t.mbox.gz
source = 0001-fs-ntfsplus-inode.c-Resolve-import-for-inode_generic.patch
source = 0002-ntfsplus-Resolve-iomap_-arguments-temporarily-for-ke.patch
source = 0003-ntfsplus-Backport-ntfs_iomap.c-functions-to-kernels-.patch
source = 0004-ntfsplus-file.c-Using-mmap-instead-of-mmap_prepare-f.patch
source = 0005-ntfsplus-compress.c-using-page-index-instead-of-page.patch
source = 0099-fs-ntfsplus-Makefile-DKMS-patch.patch
source = dkms.conf
source = 90-udev-prefer-ntfsplus.rules
sha256sums = SKIP
sha256sums = 03b57c05e6f9fbf5b5bf34507aa212f6491967f21c53a73352e7f78ebfaf66a8
sha256sums = bede30ed663dada47c946f74a314b8e25817c4cd8b6c39e0cd5810bbd1cddca2
sha256sums = 5180804263334deaa3774846d789c1553524f13e2da6149c227f35cf40252976
sha256sums = 13f17e71c2c81332c3931ff587cc6224a65a5c670e15ba318fb48e3271cdc17a
sha256sums = db0add66c82e5709cc3c96940dbb9dedeedebd60756eac47a01f97e55259be8c
sha256sums = 628687495499e6ab9269a6c27271061e417825fddfa77603902cbf931c34131c
sha256sums = f32e8cbb55c2799be918fed82037baf56b7ac31ad3c1b11b330ceaeb64893904
sha256sums = d3935300534ce7b8f548c27c5376d110f8fce283e727cc51bdf4042ea01fe8f9
sha256sums = e217fa145f507b1e07e228e746528554f705f44fd5744f293b302b29df764b96
sha256sums = ed9db8ec0caa09c977529c7ae89b808ee8c238331ec0fdf873525c115fcdfb7c
sha256sums = e3866cac3d71da15740159c89b233d4d1f61981dbf737d4e3bc9a4c56bfa24be

View file

@ -1,7 +1,7 @@
From d13a8f6cac50c99751df17154ed29ff6cc6b3b1e Mon Sep 17 00:00:00 2001
From addb62412e538ac3e6c46285c5fe392c3e32e523 Mon Sep 17 00:00:00 2001
From: shadichy <shadichy@blisslabs.org>
Date: Thu, 23 Oct 2025 01:19:10 +0700
Subject: [PATCH 1/2] fs/ntfsplus/inode.c: Resolve import for
Subject: [PATCH 1/5] fs/ntfsplus/inode.c: Resolve import for
inode_generic_drop (temporarily) for kernels older than 6.18
---
@ -26,5 +26,5 @@ index 2b8e0d67c..28925d204 100644
#include "misc.h"
#include "ntfs.h"
--
2.51.0
2.51.2

View file

@ -1,7 +1,7 @@
From 1b834436a4639aaa004d47cbbd5a3cd99cccf9f1 Mon Sep 17 00:00:00 2001
From a6d86e81b1193f8a5efa4cfd7fdcc206d6ec77fe Mon Sep 17 00:00:00 2001
From: shadichy <shadichy@blisslabs.org>
Date: Fri, 24 Oct 2025 01:48:52 +0700
Subject: [PATCH 2/2] ntfsplus: Resolve iomap_* arguments (temporarily) for
Subject: [PATCH 2/5] ntfsplus: Resolve iomap_* arguments (temporarily) for
kernel older than 6.17
---
@ -146,5 +146,5 @@ index 28925d204..dd0ee4f86 100644
return err;
}
--
2.51.0
2.51.2

View file

@ -0,0 +1,205 @@
From 5d4d8d657172d010a4bc953f600c0f40ce86a3ab Mon Sep 17 00:00:00 2001
From: shadichy <shadichy@blisslabs.org>
Date: Sun, 2 Nov 2025 03:43:12 +0700
Subject: [PATCH 3/5] ntfsplus: Backport ntfs_iomap.c functions to kernels
older than 6.17
---
fs/ntfsplus/ntfs_iomap.c | 150 ++++++++++++++++++++++++++++++++++++++-
fs/ntfsplus/ntfs_iomap.h | 8 ++-
2 files changed, 156 insertions(+), 2 deletions(-)
diff --git a/fs/ntfsplus/ntfs_iomap.c b/fs/ntfsplus/ntfs_iomap.c
index a6d2c9e01..60d7159f2 100644
--- a/fs/ntfsplus/ntfs_iomap.c
+++ b/fs/ntfsplus/ntfs_iomap.c
@@ -71,7 +71,13 @@ static void ntfs_iomap_put_folio(struct inode *inode, loff_t pos,
folio_put(folio);
}
-const struct iomap_write_ops ntfs_iomap_folio_ops = {
+const struct
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+ iomap_write_ops
+#else
+ iomap_folio_ops
+#endif
+ ntfs_iomap_folio_ops = {
.put_folio = ntfs_iomap_put_folio,
};
@@ -681,6 +687,7 @@ const struct iomap_ops ntfs_dio_iomap_ops = {
.iomap_end = ntfs_write_iomap_end,
};
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
static ssize_t ntfs_writeback_range(struct iomap_writepage_ctx *wpc,
struct folio *folio, u64 offset, unsigned int len, u64 end_pos)
{
@@ -702,3 +709,144 @@ const struct iomap_writeback_ops ntfs_writeback_ops = {
.writeback_range = ntfs_writeback_range,
.writeback_submit = iomap_ioend_writeback_submit,
};
+#else
+
+
+/*
+ * iomap_folio_state is an internal struct to the iomap subsystem and is not
+ * available in a public header. We define it here for compatibility.
+ * This definition is based on the one in fs/iomap/buffered-io.c.
+ */
+struct iomap_folio_state {
+ spinlock_t state_lock;
+ unsigned int read_bytes_pending;
+ atomic_t write_bytes_pending;
+
+ /*
+ * Each block has two bits in this bitmap:
+ * Bits [0..blocks_per_folio) has the uptodate status.
+ * Bits [b_p_f...(2*b_p_f)) has the dirty status.
+ */
+ unsigned long state[];
+};
+
+/*
+ * Compatibility implementation for kernels < 6.17
+ */
+
+static int ntfs_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode,
+ loff_t offset, unsigned int len)
+{
+ if (offset >= wpc->iomap.offset &&
+ offset < wpc->iomap.offset + wpc->iomap.length)
+ return 0;
+
+ return __ntfs_write_iomap_begin(inode, offset,
+ NTFS_I(inode)->allocated_size - offset,
+ IOMAP_WRITE, &wpc->iomap, true, false);
+}
+
+/*
+ * Based on iomap_finish_folio_write from fs/iomap/buffered-io.c in newer kernels.
+ */
+static void _ntfs_finish_folio_write(struct inode *inode, struct folio *folio,
+ size_t len)
+{
+ struct iomap_folio_state *ifs = folio->private;
+
+ WARN_ON_ONCE(i_blocks_per_folio(inode, folio) > 1 && !ifs);
+ WARN_ON_ONCE(ifs && atomic_read(&ifs->write_bytes_pending) <= 0);
+
+ if (!ifs || atomic_sub_and_test(len, &ifs->write_bytes_pending))
+ folio_end_writeback(folio);
+}
+
+/*
+ * Based on iomap_finish_ioend_buffered from fs/iomap/ioend.c in newer kernels.
+ */
+static u32 _ntfs_finish_ioend_buffered(struct iomap_ioend *ioend)
+{
+ struct inode *inode = ioend->io_inode;
+ struct bio *bio = &ioend->io_bio;
+ struct folio_iter fi;
+ u32 folio_count = 0;
+
+ if (ioend->io_error) {
+ mapping_set_error(inode->i_mapping, ioend->io_error);
+ if (!bio_flagged(bio, BIO_QUIET)) {
+ pr_err_ratelimited(
+ "%s: writeback error on inode %lu, offset %lld, sector %llu",
+ inode->i_sb->s_id, inode->i_ino,
+ ioend->io_offset, ioend->io_sector);
+ }
+ }
+
+ bio_for_each_folio_all(fi, bio) {
+ _ntfs_finish_folio_write(inode, fi.folio, fi.length);
+ folio_count++;
+ }
+
+ bio_put(bio); /* frees the ioend */
+ return folio_count;
+}
+
+/*
+ * Based on ioend_writeback_end_bio from fs/iomap/ioend.c in newer kernels.
+ */
+static void _ntfs_ioend_writeback_end_bio(struct bio *bio)
+{
+ struct iomap_ioend *ioend = iomap_ioend_from_bio(bio);
+
+ ioend->io_error = blk_status_to_errno(bio->bi_status);
+ _ntfs_finish_ioend_buffered(ioend);
+}
+
+static int ntfs_submit_ioend(struct iomap_writepage_ctx *wpc, int error)
+{
+ struct iomap_ioend *ioend = wpc->ioend;
+
+ if (!ioend)
+ return error;
+
+ if (!ioend->io_bio.bi_end_io)
+ ioend->io_bio.bi_end_io = _ntfs_ioend_writeback_end_bio;
+
+ if (WARN_ON_ONCE(wpc->iomap.flags & IOMAP_F_ANON_WRITE))
+ error = -EIO;
+
+ if (error) {
+ ioend->io_bio.bi_status = errno_to_blk_status(error);
+ bio_endio(&ioend->io_bio);
+ wpc->ioend = NULL;
+ return error;
+ }
+
+ submit_bio(&ioend->io_bio);
+ wpc->ioend = NULL;
+ return 0;
+}
+
+static void ntfs_discard_folio(struct folio *folio, loff_t pos)
+{
+ struct inode *inode = folio->mapping->host;
+ struct ntfs_inode *ni = NTFS_I(inode);
+ struct ntfs_volume *vol = ni->vol;
+ loff_t len = folio_pos(folio) + folio_size(folio) - pos;
+ s64 cluster_count;
+
+ if (len <= 0)
+ return;
+
+ cluster_count = round_up(len, vol->cluster_size) >>
+ vol->cluster_size_bits;
+
+ if (cluster_count > 0)
+ ntfs_release_dirty_clusters(vol, cluster_count);
+}
+
+const struct iomap_writeback_ops ntfs_writeback_ops = {
+ .map_blocks = ntfs_map_blocks,
+ .submit_ioend = ntfs_submit_ioend,
+ .discard_folio = ntfs_discard_folio,
+};
+#endif
\ No newline at end of file
diff --git a/fs/ntfsplus/ntfs_iomap.h b/fs/ntfsplus/ntfs_iomap.h
index b1a5d55fa..c383eaae3 100644
--- a/fs/ntfsplus/ntfs_iomap.h
+++ b/fs/ntfsplus/ntfs_iomap.h
@@ -17,6 +17,12 @@ extern const struct iomap_ops ntfs_read_iomap_ops;
extern const struct iomap_ops ntfs_page_mkwrite_iomap_ops;
extern const struct iomap_ops ntfs_dio_iomap_ops;
extern const struct iomap_writeback_ops ntfs_writeback_ops;
-extern const struct iomap_write_ops ntfs_iomap_folio_ops;
+extern const struct
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+ iomap_write_ops
+#else
+ iomap_folio_ops
+#endif
+ ntfs_iomap_folio_ops;
int ntfs_zeroed_clusters(struct inode *vi, s64 lcn, s64 num);
#endif /* _LINUX_NTFS_IOMAP_H */
--
2.51.2

View file

@ -0,0 +1,78 @@
From b2be21a87f6f9104fef7cece84642166abae55b6 Mon Sep 17 00:00:00 2001
From: shadichy <shadichy@blisslabs.org>
Date: Sun, 2 Nov 2025 04:20:28 +0700
Subject: [PATCH 4/5] ntfsplus: file.c: Using `mmap` instead of `mmap_prepare`
for kernels older than 6.15
---
fs/ntfsplus/file.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/fs/ntfsplus/file.c b/fs/ntfsplus/file.c
index 633f83261..f9caddf0b 100644
--- a/fs/ntfsplus/file.c
+++ b/fs/ntfsplus/file.c
@@ -706,6 +706,7 @@ static const struct vm_operations_struct ntfs_file_vm_ops = {
.page_mkwrite = ntfs_filemap_page_mkwrite,
};
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
static int ntfs_file_mmap_prepare(struct vm_area_desc *desc)
{
struct file *file = desc->file;
@@ -739,6 +740,40 @@ static int ntfs_file_mmap_prepare(struct vm_area_desc *desc)
return 0;
}
+#else
+static int ntfs_file_mmap(struct file *file, struct vm_area_struct *vma)
+{
+ struct inode *inode = file_inode(file);
+
+ if (NVolShutdown(NTFS_SB(file->f_mapping->host->i_sb)))
+ return -EIO;
+
+ if (NInoCompressed(NTFS_I(inode)))
+ return -EOPNOTSUPP;
+
+ if (vma->vm_flags & VM_WRITE) {
+ struct inode *inode = file_inode(file);
+ loff_t from, to;
+ int err;
+
+ from = ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
+ to = min_t(loff_t, i_size_read(inode),
+ from + vma->vm_end - vma->vm_start);
+
+ if (NTFS_I(inode)->initialized_size < to) {
+ err = ntfs_extend_initialized_size(inode, to, to);
+ if (err)
+ return err;
+ }
+ }
+
+
+ file_accessed(file);
+ vma->vm_ops = &ntfs_file_vm_ops;
+ return 0;
+}
+#endif
+
static int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
u64 start, u64 len)
{
@@ -1037,7 +1072,11 @@ const struct file_operations ntfs_file_ops = {
.read_iter = ntfs_file_read_iter,
.write_iter = ntfs_file_write_iter,
.fsync = ntfs_file_fsync,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
.mmap_prepare = ntfs_file_mmap_prepare,
+#else
+ .mmap = ntfs_file_mmap,
+#endif
.open = ntfs_file_open,
.release = ntfs_file_release,
.splice_read = ntfs_file_splice_read,
--
2.51.2

View file

@ -0,0 +1,78 @@
From 445a442563ad21156f748d45c652618921b29ebd Mon Sep 17 00:00:00 2001
From: shadichy <shadichy@blisslabs.org>
Date: Sun, 2 Nov 2025 04:35:50 +0700
Subject: [PATCH 5/5] ntfsplus: compress.c: using `page->index` instead of
`page->__folio_index` for kernels older than 6.15
---
fs/ntfsplus/compress.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/fs/ntfsplus/compress.c b/fs/ntfsplus/compress.c
index 5de465a00..4f741c890 100644
--- a/fs/ntfsplus/compress.c
+++ b/fs/ntfsplus/compress.c
@@ -109,7 +109,14 @@ static void zero_partial_compressed_page(struct page *page,
unsigned int kp_ofs;
ntfs_debug("Zeroing page region outside initialized size.");
- if (((s64)page->__folio_index << PAGE_SHIFT) >= initialized_size) {
+
+ if (((s64)page->
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
+ __folio_index
+#else
+ index
+#endif
+ << PAGE_SHIFT) >= initialized_size) {
clear_page(kp);
return;
}
@@ -123,7 +130,13 @@ static void zero_partial_compressed_page(struct page *page,
static inline void handle_bounds_compressed_page(struct page *page,
const loff_t i_size, const s64 initialized_size)
{
- if ((page->__folio_index >= (initialized_size >> PAGE_SHIFT)) &&
+ if ((page->
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
+ __folio_index
+#else
+ index
+#endif
+ >= (initialized_size >> PAGE_SHIFT)) &&
(initialized_size < i_size))
zero_partial_compressed_page(page, initialized_size);
}
@@ -470,7 +483,13 @@ int ntfs_read_compressed_block(struct folio *folio)
struct runlist_element *rl;
unsigned long flags;
u8 *cb, *cb_pos, *cb_end;
- unsigned long offset, index = page->__folio_index;
+ unsigned long offset, index = page->
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
+ __folio_index
+ #else
+ index
+ #endif
+ ;
u32 cb_size = ni->itype.compressed.block_size;
u64 cb_size_mask = cb_size - 1UL;
s64 vcn;
@@ -827,7 +846,13 @@ int ntfs_read_compressed_block(struct folio *folio)
if (page) {
ntfs_error(vol->sb,
"Still have pages left! Terminating them with extreme prejudice. Inode 0x%lx, page index 0x%lx.",
- ni->mft_no, page->__folio_index);
+ ni->mft_no, page->
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
+ __folio_index
+#else
+ index
+#endif
+ );
flush_dcache_page(page);
kunmap_local(page_address(page));
unlock_page(page);
--
2.51.2

View file

@ -3,7 +3,7 @@
pkgbase=ntfsplus-dkms-git
pkgname=("$pkgbase" "ntfsplus-udev")
pkgver=2025.10.20.r28.1fa37cd35
pkgver=2025.10.20.r32.d76784df4
pkgrel=1
# epoch=1
pkgdesc="A new NTFS driver for Linux promised to be better than NTFS3. These patches are directly taken from the maintainer's mailing list posts. Backported to 6.17."
@ -63,7 +63,10 @@ source=(
'ntfsplus-00-05.mbox.gz::https://lore.kernel.org/all/20251020020749.5522-1-linkinjeon@kernel.org/t.mbox.gz'
'ntfsplus-06-11.mbox.gz::https://lore.kernel.org/all/20251020021227.5965-6-linkinjeon@kernel.org/t.mbox.gz'
'0001-fs-ntfsplus-inode.c-Resolve-import-for-inode_generic.patch'
# '0002-ntfsplus-Resolve-iomap_-arguments-temporarily-for-ke.patch'
'0002-ntfsplus-Resolve-iomap_-arguments-temporarily-for-ke.patch'
'0003-ntfsplus-Backport-ntfs_iomap.c-functions-to-kernels-.patch'
'0004-ntfsplus-file.c-Using-mmap-instead-of-mmap_prepare-f.patch'
'0005-ntfsplus-compress.c-using-page-index-instead-of-page.patch'
'0099-fs-ntfsplus-Makefile-DKMS-patch.patch'
'dkms.conf'
'90-udev-prefer-ntfsplus.rules'
@ -72,8 +75,11 @@ sha256sums=(
SKIP
03b57c05e6f9fbf5b5bf34507aa212f6491967f21c53a73352e7f78ebfaf66a8
bede30ed663dada47c946f74a314b8e25817c4cd8b6c39e0cd5810bbd1cddca2
5180804263334deaa3774846d789c1553524f13e2da6149c227f35cf40252976
# a039bdcbdfcaf1cd22f38d22ecf12d7d1d83989e98b4d122e11e33204c78c0ae
13f17e71c2c81332c3931ff587cc6224a65a5c670e15ba318fb48e3271cdc17a
db0add66c82e5709cc3c96940dbb9dedeedebd60756eac47a01f97e55259be8c
628687495499e6ab9269a6c27271061e417825fddfa77603902cbf931c34131c
f32e8cbb55c2799be918fed82037baf56b7ac31ad3c1b11b330ceaeb64893904
d3935300534ce7b8f548c27c5376d110f8fce283e727cc51bdf4042ea01fe8f9
e217fa145f507b1e07e228e746528554f705f44fd5744f293b302b29df764b96
ed9db8ec0caa09c977529c7ae89b808ee8c238331ec0fdf873525c115fcdfb7c
e3866cac3d71da15740159c89b233d4d1f61981dbf737d4e3bc9a4c56bfa24be
@ -93,7 +99,7 @@ prepare() {
_mailbox_last_date=$(git log -1 --format='%ad' --date=iso-strict)
# Apply patches
git am "$srcdir"/0*-fs-ntfsplus-*.patch
git am "$srcdir"/0*.patch
}
pkgver() {