ntfs3: update to latest git HEAD (#7295)

Removed patches that were merged upstream.
This commit is contained in:
AmadeusGhost 2021-07-06 23:25:42 +08:00 committed by GitHub
parent 430a7b442f
commit d9e4d8d981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 664 deletions

View File

@ -11,9 +11,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/LGA1150/ntfs3-oot.git
PKG_SOURCE_DATE:=2021-04-30
PKG_SOURCE_VERSION:=4e50c89890d510fe22096bd6be3b640abf295e59
PKG_MIRROR_HASH:=311ee651f55ec46daa5c3e0029108e9a5c511553c4baf0daecd25efb4235b991
PKG_SOURCE_DATE:=2021-07-05
PKG_SOURCE_VERSION:=46d199e7d7302879b23ad20097ba53b152257288
PKG_MIRROR_HASH:=0c2ab3d15e5900c35b7cef3dcafb814991e8d98ef6ff715650b9c0b686364b81
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0-only

View File

@ -1,661 +0,0 @@
From c6f296390b6cd3fdafd26c0dcca6b3aacf7db837 Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Sat, 26 Jun 2021 11:20:08 +0800
Subject: [PATCH] ntfs3: backport support to kernel 4.x
---
compat.h | 39 +++++++++++++++++++++++++++++++++++++
dir.c | 6 +++++-
file.c | 19 ++++++++++++++++--
frecord.c | 15 +++++++++++++-
fslog.c | 13 +++++++++++++
fsntfs.c | 21 ++++++++++++++++++++
inode.c | 14 +++++++++++++-
namei.c | 18 ++++++++++++++++-
ntfs.h | 1 +
ntfs_fs.h | 8 ++++++--
run.c | 8 ++++++++
super.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
xattr.c | 12 ++++++++++++
13 files changed, 223 insertions(+), 9 deletions(-)
create mode 100644 compat.h
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __bitmap_set
+#define __bitmap_set(a, b, c) bitmap_set(a, b, c)
+#endif
+
+#ifndef __bitmap_clear
+#define __bitmap_clear(a, b, c) bitmap_clear(a, b, c)
+#endif
+
+/*
+ * Copy from include/linux/compiler_attributes.h
+ */
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#ifndef fallthrough
+#if __has_attribute(__fallthrough__)
+#define fallthrough __attribute__((__fallthrough__))
+#else
+#define fallthrough do {} while (0) /* fallthrough */
+#endif
+#endif
+
+/*
+ * Copy from include/linux/build_bug.h
+ */
+#ifndef static_assert
+#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
+#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
+#endif
+
+/*
+ * Copy from include/linux/overflow.h
+ */
+#ifndef struct_size
+#define struct_size(p, member, n) (sizeof(*(p)) + n * sizeof(*(p)->member))
+#endif
--- a/dir.c
+++ b/dir.c
@@ -9,8 +9,12 @@
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
-#include <linux/iversion.h>
#include <linux/nls.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#include <linux/iversion.h>
+#endif
#include "debug.h"
#include "ntfs.h"
--- a/file.c
+++ b/file.c
@@ -12,6 +12,7 @@
#include <linux/fiemap.h>
#include <linux/msdos_fs.h> /* FAT_IOCTL_XXX */
#include <linux/nls.h>
+#include <linux/uio.h>
#include "debug.h"
#include "ntfs.h"
@@ -78,14 +79,23 @@ static long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg)
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
int ntfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
+ struct kstat *stat, u32 request_mask, u32 flags)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+int ntfs_getattr(const struct path *path, struct kstat *stat,
+ u32 request_mask, u32 flags)
#else
-int ntfs_getattr(const struct path *path,
+int ntfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
+ struct kstat *stat)
#endif
- struct kstat *stat, u32 request_mask, u32 flags)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
struct inode *inode = d_inode(path->dentry);
struct ntfs_inode *ni = ntfs_i(inode);
+#else
+ struct inode *inode = d_inode(dentry);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
if (is_compressed(ni))
stat->attributes |= STATX_ATTR_COMPRESSED;
@@ -93,6 +103,7 @@ int ntfs_getattr(const struct path *path,
stat->attributes |= STATX_ATTR_ENCRYPTED;
stat->attributes_mask |= STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
generic_fillattr(mnt_userns, inode, stat);
@@ -100,8 +111,10 @@ int ntfs_getattr(const struct path *path,
generic_fillattr(inode, stat);
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
stat->result_mask |= STATX_BTIME;
stat->btime = ni->i_crtime;
+#endif
return 0;
}
@@ -1021,8 +1034,10 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
}
if (!inode_trylock(inode)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
if (iocb->ki_flags & IOCB_NOWAIT)
return -EAGAIN;
+#endif
inode_lock(inode);
}
--- a/frecord.c
+++ b/frecord.c
@@ -10,6 +10,7 @@
#include <linux/fiemap.h>
#include <linux/fs.h>
#include <linux/nls.h>
+#include <linux/version.h>
#include <linux/vmalloc.h>
#include "debug.h"
@@ -2831,7 +2832,11 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup,
struct ntfs_sb_info *sbi = ni->mi.sbi;
struct super_block *sb = sbi->sb;
bool re_dirty = false;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
bool active = sb->s_flags & SB_ACTIVE;
+#else
+ bool active = sb->s_flags & MS_ACTIVE;
+#endif
bool upd_parent = ni->ni_flags & NI_FLAG_UPDATE_PARENT;
if (ni->mi.mrec->flags & RECORD_FLAG_DIR) {
@@ -2951,7 +2956,11 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint)
struct rb_node *node, *next;
struct NTFS_DUP_INFO dup;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (is_bad_inode(inode) || sb_rdonly(sb))
+#else
+ if (is_bad_inode(inode) || (sb->s_flags & MS_RDONLY))
+#endif
return 0;
if (!ni_trylock(ni)) {
@@ -3064,7 +3073,11 @@ out:
return err;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (re_dirty && (sb->s_flags & SB_ACTIVE))
+#else
+ if (re_dirty && (sb->s_flags & MS_ACTIVE))
+#endif
mark_inode_dirty_sync(inode);
return 0;
--- a/fslog.c
+++ b/fslog.c
@@ -13,6 +13,7 @@
#include <linux/random.h>
#include <linux/ratelimit.h>
#include <linux/slab.h>
+#include <linux/version.h>
#include "debug.h"
#include "ntfs.h"
@@ -2166,7 +2167,11 @@ file_is_valid:
if (page_off1 || tail_page) {
struct RECORD_PAGE_HDR *tmp_page;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (sb_rdonly(log->ni->mi.sbi->sb)) {
+#else
+ if (log->ni->mi.sbi->sb->s_flags & MS_RDONLY) {
+#endif
err = -EROFS;
goto out;
}
@@ -2223,7 +2228,11 @@ file_is_valid:
}
if (part_io_count) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (sb_rdonly(log->ni->mi.sbi->sb)) {
+#else
+ if (log->ni->mi.sbi->sb->s_flags & MS_RDONLY) {
+#endif
err = -EROFS;
goto out;
}
@@ -3768,7 +3777,11 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
const struct LFS_RECORD_HDR *frh;
const struct LOG_REC_HDR *lrh;
bool is_mapped;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
bool is_ro = sb_rdonly(sbi->sb);
+#else
+ bool is_ro = sbi->sb->s_flags & MS_RDONLY;
+#endif
u64 t64;
u16 t16;
u32 t32;
--- a/fsntfs.c
+++ b/fsntfs.c
@@ -9,6 +9,7 @@
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/nls.h>
+#include <linux/version.h>
#include "debug.h"
#include "ntfs.h"
@@ -314,7 +315,11 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi)
goto out;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (sb_rdonly(sb) || !initialized)
+#else
+ if ((sb->s_flags & MS_RDONLY) || !initialized)
+#endif
goto out;
/* fill LogFile by '-1' if it is initialized */
@@ -940,7 +945,11 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
* do not change state if fs already dirty(clear)
* do not change any thing if mounted read only
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (sbi->volume.real_dirty || sb_rdonly(sbi->sb))
+#else
+ if (sbi->volume.real_dirty || (sbi->sb->s_flags & MS_RDONLY))
+#endif
return 0;
/* Check cached value */
@@ -1049,7 +1058,11 @@ int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes,
u32 op = blocksize - off;
struct buffer_head *bh;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (!wait && (sb->s_flags & SB_SYNCHRONOUS))
+#else
+ if (!wait && (sb->s_flags & MS_SYNCHRONOUS))
+#endif
wait = 1;
for (; bytes; block += 1, off = 0, op = blocksize) {
@@ -1528,7 +1541,11 @@ new_bio:
submit_bio(bio);
}
bio = new;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
bio_set_dev(bio, bdev);
+#else
+ bio->bi_bdev = bdev;
+#endif
bio->bi_iter.bi_sector = lbo >> 9;
bio->bi_opf = op;
@@ -1634,7 +1651,11 @@ new_bio:
submit_bio(bio);
}
bio = new;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
bio_set_dev(bio, bdev);
+#else
+ bio->bi_bdev = bdev;
+#endif
bio->bi_opf = REQ_OP_WRITE;
bio->bi_iter.bi_sector = lbo >> 9;
--- a/inode.c
+++ b/inode.c
@@ -8,7 +8,6 @@
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
-#include <linux/iversion.h>
#include <linux/mpage.h>
#include <linux/namei.h>
#include <linux/nls.h>
@@ -16,6 +15,10 @@
#include <linux/version.h>
#include <linux/writeback.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#include <linux/iversion.h>
+#endif
+
#include "debug.h"
#include "ntfs.h"
#include "ntfs_fs.h"
@@ -1597,7 +1600,11 @@ struct inode *ntfs_create_inode(
inode->i_mode = mode;
#ifdef CONFIG_NTFS3_FS_POSIX_ACL
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (!is_link && (sb->s_flags & SB_POSIXACL)) {
+#else
+ if (!is_link && (sb->s_flags & MS_POSIXACL)) {
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
err = ntfs_init_acl(mnt_userns, inode, dir);
#else
@@ -1646,7 +1653,12 @@ out4:
clear_rec_inuse(rec);
clear_nlink(inode);
ni->mi.dirty = false;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
discard_new_inode(inode);
+#else
+ unlock_new_inode(inode);
+ iput(inode);
+#endif
out3:
ntfs_mark_rec_free(sbi, ino);
--- a/namei.c
+++ b/namei.c
@@ -8,9 +8,13 @@
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
-#include <linux/iversion.h>
#include <linux/namei.h>
#include <linux/nls.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#include <linux/iversion.h>
+#endif
#include "debug.h"
#include "ntfs.h"
@@ -500,7 +504,11 @@ out:
* inode_operations::atomic_open
*/
static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
struct file *file, u32 flags, umode_t mode)
+#else
+ struct file *file, u32 flags, umode_t mode, int *opened)
+#endif
{
int err;
bool excl = !!(flags & O_EXCL);
@@ -544,7 +552,11 @@ static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,
goto out2;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
file->f_mode |= FMODE_CREATED;
+#else
+ *opened |= FILE_CREATED;
+#endif
/*fnd contains tree's path to insert to*/
/* TODO: init_user_ns? */
@@ -555,7 +567,11 @@ static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,
#endif
NULL, 0, excl, fnd);
err = IS_ERR(inode) ? PTR_ERR(inode)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
: finish_open(file, dentry, ntfs_file_open);
+#else
+ : finish_open(file, dentry, ntfs_file_open, opened);
+#endif
dput(d);
out2:
--- a/ntfs.h
+++ b/ntfs.h
@@ -8,6 +8,7 @@
// clang-format off
#include <linux/version.h>
+#include "compat.h"
/* TODO:
* - Check 4K mft record and 512 bytes cluster
--- a/ntfs_fs.h
+++ b/ntfs_fs.h
@@ -455,10 +455,14 @@ extern const struct file_operations ntfs_dir_operations;
/* globals from file.c*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
int ntfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
+ struct kstat *stat, u32 request_mask, u32 flags);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+int ntfs_getattr(const struct path *path, struct kstat *stat,
+ u32 request_mask, u32 flags);
#else
-int ntfs_getattr(const struct path *path,
+int ntfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
+ struct kstat *stat);
#endif
- struct kstat *stat, u32 request_mask, u32 flags);
void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn,
CLST len);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
--- a/run.c
+++ b/run.c
@@ -10,6 +10,8 @@
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/nls.h>
+#include <linux/version.h>
+#include <linux/vmalloc.h>
#include "debug.h"
#include "ntfs.h"
@@ -387,7 +389,13 @@ requires_new_range:
WARN_ON(!is_mft && bytes > NTFS3_RUN_MAX_BYTES);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
new_ptr = ntfs_vmalloc(bytes);
+#else
+ new_ptr = kmalloc(bytes, GFP_KERNEL | __GFP_NOWARN);
+ if (!new_ptr)
+ new_ptr = vmalloc(bytes);
+#endif
if (!new_ptr)
return false;
--- a/super.c
+++ b/super.c
@@ -26,12 +26,17 @@
#include <linux/buffer_head.h>
#include <linux/exportfs.h>
#include <linux/fs.h>
-#include <linux/iversion.h>
#include <linux/module.h>
#include <linux/nls.h>
#include <linux/parser.h>
#include <linux/seq_file.h>
#include <linux/statfs.h>
+#include <linux/version.h>
+#include <linux/vmalloc.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#include <linux/iversion.h>
+#endif
#include "debug.h"
#include "ntfs.h"
@@ -317,14 +322,22 @@ static noinline int ntfs_parse_options(struct super_block *sb, char *options,
break;
case Opt_acl:
#ifdef CONFIG_NTFS3_FS_POSIX_ACL
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
sb->s_flags |= SB_POSIXACL;
+#else
+ sb->s_flags |= MS_POSIXACL;
+#endif
break;
#else
ntfs_err(sb, "support for ACL not compiled in!");
return -EINVAL;
#endif
case Opt_noatime:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
sb->s_flags |= SB_NOATIME;
+#else
+ sb->s_flags |= MS_NOATIME;
+#endif
break;
case Opt_showmeta:
opts->showmeta = 1;
@@ -389,7 +402,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data)
if (err)
goto restore_opts;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
ro_rw = sb_rdonly(sb) && !(*flags & SB_RDONLY);
+#else
+ ro_rw = (sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY);
+#endif
if (ro_rw && (sbi->flags & NTFS_FLAGS_NEED_REPLAY)) {
ntfs_warn(
sb,
@@ -409,8 +426,13 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data)
clear_mount_options(&old_opts);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
*flags = (*flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYTIME) |
SB_NODIRATIME | SB_NOATIME;
+#else
+ *flags = (*flags & ~MS_LAZYTIME) | (sb->s_flags & MS_LAZYTIME) |
+ MS_NODIRATIME | MS_NOATIME;
+#endif
ntfs_info(sb, "re-mounted. Opts: %s", orig_data);
err = 0;
goto out;
@@ -578,9 +600,17 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root)
seq_puts(m, ",no_acs_rules");
if (opts->prealloc)
seq_puts(m, ",prealloc");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (sb->s_flags & SB_POSIXACL)
+#else
+ if (sb->s_flags & MS_POSIXACL)
+#endif
seq_puts(m, ",acl");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (sb->s_flags & SB_NOATIME)
+#else
+ if (sb->s_flags & MS_NOATIME)
+#endif
seq_puts(m, ",noatime");
return 0;
@@ -834,7 +864,11 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
sb,
"RAW NTFS volume: Filesystem size %u.%02u Gb > volume size %u.%02u Gb. Mount in read-only",
gb, mb, gb0, mb0);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
sb->s_flags |= SB_RDONLY;
+#else
+ sb->s_flags |= MS_RDONLY;
+#endif
}
clusters = sbi->volume.size >> sbi->cluster_bits;
@@ -926,7 +960,11 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_fs_info = sbi;
sbi->sb = sb;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
sb->s_flags |= SB_NODIRATIME;
+#else
+ sb->s_flags |= MS_NODIRATIME;
+#endif
sb->s_magic = 0x7366746e; // "ntfs"
sb->s_op = &ntfs_sops;
sb->s_export_op = &ntfs_export_ops;
@@ -1058,7 +1096,11 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
iput(inode);
inode = NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
is_ro = sb_rdonly(sbi->sb);
+#else
+ is_ro = sbi->sb->s_flags & MS_RDONLY;
+#endif
if (sbi->flags & NTFS_FLAGS_NEED_REPLAY) {
if (!is_ro) {
@@ -1252,7 +1294,13 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
goto out;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
sbi->upcase = upcase = ntfs_vmalloc(0x10000 * sizeof(short));
+#else
+ sbi->upcase = upcase = kmalloc(0x10000 * sizeof(short), GFP_KERNEL | __GFP_NOWARN);
+ if (!upcase)
+ sbi->upcase = upcase = vmalloc(0x10000 * sizeof(short));
+#endif
if (!upcase) {
err = -ENOMEM;
goto out;
@@ -1354,7 +1402,11 @@ void ntfs_unmap_meta(struct super_block *sb, CLST lcn, CLST len)
sector_t devblock = (u64)lcn * sbi->blocks_per_cluster;
unsigned long blocks = (u64)len * sbi->blocks_per_cluster;
unsigned long cnt = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
unsigned long limit = global_zone_page_state(NR_FREE_PAGES)
+#else
+ unsigned long limit = global_page_state(NR_FREE_PAGES)
+#endif
<< (PAGE_SHIFT - sb->s_blocksize_bits);
if (limit >= 0x2000)
@@ -1365,7 +1417,11 @@ void ntfs_unmap_meta(struct super_block *sb, CLST lcn, CLST len)
limit >>= 1;
while (blocks--) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
clean_bdev_aliases(bdev, devblock++, 1);
+#else
+ unmap_underlying_metadata(bdev, devblock++);
+#endif
if (cnt++ >= limit) {
sync_blockdev(bdev);
cnt = 0;
--- a/xattr.c
+++ b/xattr.c
@@ -659,7 +659,11 @@ static int ntfs_xattr_get_acl(
struct posix_acl *acl;
int err;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (!(inode->i_sb->s_flags & SB_POSIXACL))
+#else
+ if (!(inode->i_sb->s_flags & MS_POSIXACL))
+#endif
return -EOPNOTSUPP;
acl = ntfs_get_acl(inode, type);
@@ -690,7 +694,11 @@ static int ntfs_xattr_set_acl(
struct posix_acl *acl;
int err;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (!(inode->i_sb->s_flags & SB_POSIXACL))
+#else
+ if (!(inode->i_sb->s_flags & MS_POSIXACL))
+#endif
return -EOPNOTSUPP;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
@@ -822,7 +830,11 @@ int ntfs_acl_chmod(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
if (!(sb->s_flags & SB_POSIXACL))
+#else
+ if (!(sb->s_flags & MS_POSIXACL))
+#endif
return 0;
if (S_ISLNK(inode->i_mode))