Merge git://github.com/Paragon-Software-Group/linux-ntfs3
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Sep 2021 18:15:50 +0000 (11:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Sep 2021 18:15:50 +0000 (11:15 -0700)
Merge NTFSv3 filesystem from Konstantin Komarov:
 "This patch adds NTFS Read-Write driver to fs/ntfs3.

  Having decades of expertise in commercial file systems development and
  huge test coverage, we at Paragon Software GmbH want to make our
  contribution to the Open Source Community by providing implementation
  of NTFS Read-Write driver for the Linux Kernel.

  This is fully functional NTFS Read-Write driver. Current version works
  with NTFS (including v3.1) and normal/compressed/sparse files and
  supports journal replaying.

  We plan to support this version after the codebase once merged, and
  add new features and fix bugs. For example, full journaling support
  over JBD will be added in later updates"

Link: https://lore.kernel.org/lkml/20210729134943.778917-1-almaz.alexandrovich@paragon-software.com/
Link: https://lore.kernel.org/lkml/aa4aa155-b9b2-9099-b7a2-349d8d9d8fbd@paragon-software.com/
* git://github.com/Paragon-Software-Group/linux-ntfs3: (35 commits)
  fs/ntfs3: Change how module init/info messages are displayed
  fs/ntfs3: Remove GPL boilerplates from decompress lib files
  fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter
  fs/ntfs3: Fix integer overflow in ni_fiemap with fiemap_prep()
  fs/ntfs3: Restyle comments to better align with kernel-doc
  fs/ntfs3: Rework file operations
  fs/ntfs3: Remove fat ioctl's from ntfs3 driver for now
  fs/ntfs3: Restyle comments to better align with kernel-doc
  fs/ntfs3: Fix error handling in indx_insert_into_root()
  fs/ntfs3: Potential NULL dereference in hdr_find_split()
  fs/ntfs3: Fix error code in indx_add_allocate()
  fs/ntfs3: fix an error code in ntfs_get_acl_ex()
  fs/ntfs3: add checks for allocation failure
  fs/ntfs3: Use kcalloc/kmalloc_array over kzalloc/kmalloc
  fs/ntfs3: Do not use driver own alloc wrappers
  fs/ntfs3: Use kernel ALIGN macros over driver specific
  fs/ntfs3: Restyle comment block in ni_parse_reparse()
  fs/ntfs3: Remove unused including <linux/version.h>
  fs/ntfs3: Fix fall-through warnings for Clang
  fs/ntfs3: Fix one none utf8 char in source file
  ...

1  2 
Documentation/filesystems/index.rst
MAINTAINERS
fs/Kconfig
fs/Makefile
fs/ntfs3/ntfs_fs.h
fs/ntfs3/xattr.c

@@@ -34,7 -34,6 +34,7 @@@ algorithms work
     quota
     seq_file
     sharedsubtree
 +   idmappings
  
     automount-support
  
@@@ -73,7 -72,7 +73,7 @@@ Documentation for filesystem implementa
     befs
     bfs
     btrfs
 -   cifs/cifsroot
 +   cifs/index
     ceph
     coda
     configfs
     nilfs2
     nfs/index
     ntfs
+    ntfs3
     ocfs2
     ocfs2-online-filecheck
     omfs
diff --combined MAINTAINERS
@@@ -459,12 -459,6 +459,12 @@@ S:       Maintaine
  W:    https://parisc.wiki.kernel.org/index.php/AD1889
  F:    sound/pci/ad1889.*
  
 +AD5110 ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER
 +M:    Mugilraj Dhavachelvan <dmugil2000@gmail.com>
 +L:    linux-iio@vger.kernel.org
 +S:    Supported
 +F:    drivers/iio/potentiometer/ad5110.c
 +
  AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER
  M:    Michael Hennerich <michael.hennerich@analog.com>
  S:    Supported
@@@ -798,7 -792,7 +798,7 @@@ F: Documentation/devicetree/bindings/i2
  F:    drivers/i2c/busses/i2c-altera.c
  
  ALTERA MAILBOX DRIVER
 -M:    Ley Foon Tan <ley.foon.tan@intel.com>
 +M:    Joyce Ooi <joyce.ooi@intel.com>
  S:    Maintained
  F:    drivers/mailbox/mailbox-altera.c
  
@@@ -1268,13 -1262,6 +1268,13 @@@ L:    linux-input@vger.kernel.or
  S:    Odd fixes
  F:    drivers/input/mouse/bcm5974.c
  
 +APPLE DART IOMMU DRIVER
 +M:    Sven Peter <sven@svenpeter.dev>
 +L:    iommu@lists.linux-foundation.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/iommu/apple,dart.yaml
 +F:    drivers/iommu/apple-dart.c
 +
  APPLE SMC DRIVER
  M:    Henrik Rydberg <rydberg@bitmath.org>
  L:    linux-hwmon@vger.kernel.org
@@@ -1329,13 -1316,6 +1329,13 @@@ L:    linux-media@vger.kernel.or
  S:    Maintained
  F:    drivers/media/i2c/aptina-pll.*
  
 +AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER
 +M:    Aleksa Savic <savicaleksa83@gmail.com>
 +L:    linux-hwmon@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/hwmon/aquacomputer_d5next.rst
 +F:    drivers/hwmon/aquacomputer_d5next.c
 +
  AQUANTIA ETHERNET DRIVER (atlantic)
  M:    Igor Russkikh <irusskikh@marvell.com>
  L:    netdev@vger.kernel.org
@@@ -1402,7 -1382,7 +1402,7 @@@ F:      Documentation/devicetree/bindings/ar
  F:    Documentation/devicetree/bindings/arm/arm,realview.yaml
  F:    Documentation/devicetree/bindings/arm/arm,versatile.yaml
  F:    Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml
 -F:    Documentation/devicetree/bindings/auxdisplay/arm-charlcd.txt
 +F:    Documentation/devicetree/bindings/auxdisplay/arm,versatile-lcd.yaml
  F:    Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
  F:    Documentation/devicetree/bindings/i2c/i2c-versatile.txt
  F:    Documentation/devicetree/bindings/interrupt-controller/arm,versatile-fpga-irq.txt
@@@ -1508,7 -1488,7 +1508,7 @@@ M:      Miquel Raynal <miquel.raynal@bootlin
  M:    Naga Sureshkumar Relli <nagasure@xilinx.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/mtd/arm,pl353-smc.yaml
 +F:    Documentation/devicetree/bindings/memory-controllers/arm,pl353-smc.yaml
  F:    drivers/memory/pl353-smc.c
  
  ARM PRIMECELL CLCD PL110 DRIVER
@@@ -1710,7 -1690,7 +1710,7 @@@ L:      linux-arm-kernel@lists.infradead.or
  S:    Maintained
  W:    https://asahilinux.org
  B:    https://github.com/AsahiLinux/linux/issues
 -C:    irc://chat.freenode.net/asahi-dev
 +C:    irc://irc.oftc.net/asahi-dev
  T:    git https://github.com/AsahiLinux/linux.git
  F:    Documentation/devicetree/bindings/arm/apple.yaml
  F:    Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
@@@ -2030,12 -2010,10 +2030,12 @@@ M:   Krzysztof Halasa <khalasa@piap.pl
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
 +F:    Documentation/devicetree/bindings/bus/intel,ixp4xx-expansion-bus-controller.yaml
  F:    Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
  F:    Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
  F:    Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
  F:    arch/arm/mach-ixp4xx/
 +F:    drivers/bus/intel-ixp4xx-eb.c
  F:    drivers/clocksource/timer-ixp4xx.c
  F:    drivers/crypto/ixp4xx_crypto.c
  F:    drivers/gpio/gpio-ixp4xx.c
@@@ -2864,7 -2842,7 +2864,7 @@@ AS3645A LED FLASH CONTROLLER DRIVE
  M:    Sakari Ailus <sakari.ailus@iki.fi>
  L:    linux-leds@vger.kernel.org
  S:    Maintained
 -F:    drivers/leds/leds-as3645a.c
 +F:    drivers/leds/flash/leds-as3645a.c
  
  ASAHI KASEI AK7375 LENS VOICE COIL DRIVER
  M:    Tianshu Qiu <tian.shu.qiu@intel.com>
@@@ -3219,7 -3197,7 +3219,7 @@@ S:      Maintaine
  W:    https://www.open-mesh.org/
  Q:    https://patchwork.open-mesh.org/project/batman/list/
  B:    https://www.open-mesh.org/projects/batman-adv/issues
 -C:    irc://chat.freenode.net/batman
 +C:    ircs://irc.hackint.org/batadv
  T:    git https://git.open-mesh.org/linux-merge.git
  F:    Documentation/networking/batman-adv.rst
  F:    include/uapi/linux/batadv_packet.h
@@@ -3431,6 -3409,7 +3431,6 @@@ F:      drivers/net/ethernet/netronome/nfp/b
  
  BPF JIT for POWERPC (32-BIT AND 64-BIT)
  M:    Naveen N. Rao <naveen.n.rao@linux.ibm.com>
 -M:    Sandipan Das <sandipan@linux.ibm.com>
  L:    netdev@vger.kernel.org
  L:    bpf@vger.kernel.org
  S:    Maintained
@@@ -3876,7 -3855,7 +3876,7 @@@ M:      Markus Mayer <mmayer@broadcom.com
  M:    bcm-kernel-feedback-list@broadcom.com
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.txt
 +F:    Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml
  F:    drivers/memory/brcmstb_dpfe.c
  
  BROADCOM STB NAND FLASH DRIVER
@@@ -4532,7 -4511,6 +4532,7 @@@ B:      https://github.com/ClangBuiltLinux/l
  C:    irc://irc.libera.chat/clangbuiltlinux
  F:    Documentation/kbuild/llvm.rst
  F:    include/linux/compiler-clang.h
 +F:    scripts/Makefile.clang
  F:    scripts/clang-tools/
  K:    \b(?i:clang|llvm)\b
  
@@@ -4642,7 -4620,7 +4642,7 @@@ F:      include/linux/clk
  F:    include/linux/of_clk.h
  X:    drivers/clk/clkdev.c
  
 -COMMON INTERNET FILE SYSTEM (CIFS)
 +COMMON INTERNET FILE SYSTEM CLIENT (CIFS)
  M:    Steve French <sfrench@samba.org>
  L:    linux-cifs@vger.kernel.org
  L:    samba-technical@lists.samba.org (moderated for non-subscribers)
@@@ -4651,7 -4629,6 +4651,7 @@@ W:      http://linux-cifs.samba.org
  T:    git git://git.samba.org/sfrench/cifs-2.6.git
  F:    Documentation/admin-guide/cifs/
  F:    fs/cifs/
 +F:    fs/cifs_common/
  
  COMPACTPCI HOTPLUG CORE
  M:    Scott Murray <scott@spiteful.org>
@@@ -5603,7 -5580,7 +5603,7 @@@ M:      Lukasz Luba <lukasz.luba@arm.com
  L:    linux-pm@vger.kernel.org
  L:    linux-samsung-soc@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/memory-controllers/exynos5422-dmc.txt
 +F:    Documentation/devicetree/bindings/memory-controllers/samsung,exynos5422-dmc.yaml
  F:    drivers/memory/samsung/exynos5422-dmc.c
  
  DME1737 HARDWARE MONITOR DRIVER
@@@ -5717,7 -5694,6 +5717,7 @@@ DPAA2 ETHERNET SWITCH DRIVE
  M:    Ioana Ciornei <ioana.ciornei@nxp.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
 +F:    Documentation/networking/device_drivers/ethernet/freescale/dpaa2/switch-driver.rst
  F:    drivers/net/ethernet/freescale/dpaa2/dpaa2-switch*
  F:    drivers/net/ethernet/freescale/dpaa2/dpsw*
  
@@@ -5741,11 -5717,6 +5741,11 @@@ F:    Documentation/admin-guide/blockdev
  F:    drivers/block/drbd/
  F:    lib/lru_cache.c
  
 +DRIVER COMPONENT FRAMEWORK
 +L:    dri-devel@lists.freedesktop.org
 +F:    drivers/base/component.c
 +F:    include/linux/component.h
 +
  DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  R:    "Rafael J. Wysocki" <rafael@kernel.org>
@@@ -5809,7 -5780,7 +5809,7 @@@ M:      Gerd Hoffmann <kraxel@redhat.com
  L:    virtualization@lists.linux-foundation.org
  S:    Maintained
  T:    git git://anongit.freedesktop.org/drm/drm-misc
 -F:    drivers/gpu/drm/bochs/
 +F:    drivers/gpu/drm/tiny/bochs.c
  
  DRM DRIVER FOR BOE HIMAX8279D PANELS
  M:    Jerry Han <hanxu5@huaqin.corp-partner.google.com>
@@@ -5994,13 -5965,6 +5994,13 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml
  F:    drivers/gpu/drm/panel/panel-raydium-rm67191.c
  
 +DRM DRIVER FOR SAMSUNG DB7430 PANELS
 +M:    Linus Walleij <linus.walleij@linaro.org>
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
 +F:    drivers/gpu/drm/panel/panel-samsung-db7430.c
 +
  DRM DRIVER FOR SITRONIX ST7703 PANELS
  M:    Guido Günther <agx@sigxcpu.org>
  R:    Purism Kernel Team <kernel@puri.sm>
@@@ -6099,27 -6063,21 +6099,27 @@@ F:   drivers/gpu/drm/vboxvideo
  
  DRM DRIVER FOR VMWARE VIRTUAL GPU
  M:    "VMware Graphics" <linux-graphics-maintainer@vmware.com>
 -M:    Roland Scheidegger <sroland@vmware.com>
  M:    Zack Rusin <zackr@vmware.com>
  L:    dri-devel@lists.freedesktop.org
  S:    Supported
 -T:    git git://people.freedesktop.org/~sroland/linux
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
  F:    drivers/gpu/drm/vmwgfx/
  F:    include/uapi/drm/vmwgfx_drm.h
  
 +DRM DRIVER FOR WIDECHIPS WS2401 PANELS
 +M:    Linus Walleij <linus.walleij@linaro.org>
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
 +F:    drivers/gpu/drm/panel/panel-widechips-ws2401.c
 +
  DRM DRIVERS
  M:    David Airlie <airlied@linux.ie>
  M:    Daniel Vetter <daniel@ffwll.ch>
  L:    dri-devel@lists.freedesktop.org
  S:    Maintained
  B:    https://gitlab.freedesktop.org/drm
 -C:    irc://chat.freenode.net/dri-devel
 +C:    irc://irc.oftc.net/dri-devel
  T:    git git://anongit.freedesktop.org/drm/drm
  F:    Documentation/devicetree/bindings/display/
  F:    Documentation/devicetree/bindings/gpu/
@@@ -6612,7 -6570,6 +6612,7 @@@ EDAC-ARMAD
  M:    Jan Luebbe <jlu@pengutronix.de>
  L:    linux-edac@vger.kernel.org
  S:    Maintained
 +F:    Documentation/devicetree/bindings/memory-controllers/marvell,mvebu-sdram-controller.yaml
  F:    drivers/edac/armada_xp_*
  
  EDAC-AST2500
@@@ -6854,6 -6811,7 +6854,6 @@@ F:      Documentation/admin-guide/media/em28
  F:    drivers/media/usb/em28xx/
  
  EMBEDDED LINUX
 -M:    Paul Gortmaker <paul.gortmaker@windriver.com>
  M:    Matt Mackall <mpm@selenic.com>
  M:    David Woodhouse <dwmw2@infradead.org>
  L:    linux-embedded@vger.kernel.org
@@@ -6956,12 -6914,6 +6956,12 @@@ M:    Mark Einon <mark.einon@gmail.com
  S:    Odd Fixes
  F:    drivers/net/ethernet/agere/
  
 +ETAS ES58X CAN/USB DRIVER
 +M:    Vincent Mailhol <mailhol.vincent@wanadoo.fr>
 +L:    linux-can@vger.kernel.org
 +S:    Maintained
 +F:    drivers/net/can/usb/etas_es58x/
 +
  ETHERNET BRIDGE
  M:    Roopa Prabhu <roopa@nvidia.com>
  M:    Nikolay Aleksandrov <nikolay@nvidia.com>
@@@ -7003,7 -6955,7 +7003,7 @@@ F:      include/uapi/linux/mdio.
  F:    include/uapi/linux/mii.h
  
  EXFAT FILE SYSTEM
 -M:    Namjae Jeon <namjae.jeon@samsung.com>
 +M:    Namjae Jeon <linkinjeon@kernel.org>
  M:    Sungjong Seo <sj1557.seo@samsung.com>
  L:    linux-fsdevel@vger.kernel.org
  S:    Maintained
@@@ -8453,7 -8405,7 +8453,7 @@@ F:      drivers/crypto/hisilicon/sgl.
  F:    drivers/crypto/hisilicon/zip/
  
  HISILICON ROCE DRIVER
 -M:    Lijun Ou <oulijun@huawei.com>
 +M:    Wenpeng Liang <liangwenpeng@huawei.com>
  M:    Weihang Li <liweihang@huawei.com>
  L:    linux-rdma@vger.kernel.org
  S:    Maintained
@@@ -8491,12 -8443,10 +8491,12 @@@ S:   Maintaine
  F:    Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml
  F:    drivers/spmi/hisi-spmi-controller.c
  
 -HISILICON STAGING DRIVERS FOR HIKEY 960/970
 +HISILICON SPMI PMIC DRIVER FOR HIKEY 6421v600
  M:    Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
 +L:    linux-kernel@vger.kernel.org
  S:    Maintained
 -F:    drivers/staging/hikey9xx/
 +F:    Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml
 +F:    drivers/mfd/hi6421-spmi-pmic.c
  
  HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT
  M:    Zaibo Xu <xuzaibo@huawei.com>
@@@ -8655,9 -8605,6 +8655,9 @@@ T:      git git://git.kernel.org/pub/scm/lin
  F:    Documentation/ABI/stable/sysfs-bus-vmbus
  F:    Documentation/ABI/testing/debugfs-hyperv
  F:    Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst
 +F:    arch/arm64/hyperv
 +F:    arch/arm64/include/asm/hyperv-tlfs.h
 +F:    arch/arm64/include/asm/mshyperv.h
  F:    arch/x86/hyperv
  F:    arch/x86/include/asm/hyperv-tlfs.h
  F:    arch/x86/include/asm/mshyperv.h
@@@ -9104,7 -9051,7 +9104,7 @@@ F:      drivers/usb/atm/ueagle-atm.
  IMGTEC ASCII LCD DRIVER
  M:    Paul Burton <paulburton@kernel.org>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
 +F:    Documentation/devicetree/bindings/auxdisplay/img,ascii-lcd.yaml
  F:    drivers/auxdisplay/img-ascii-lcd.c
  
  IMGTEC IR DECODER DRIVER
@@@ -9276,20 -9223,13 +9276,20 @@@ INTEL ATOMISP2 DUMMY / POWER-MANAGEMEN
  M:    Hans de Goede <hdegoede@redhat.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel_atomisp2_pm.c
 +F:    drivers/platform/x86/intel/atomisp2/pm.c
  
  INTEL ATOMISP2 LED DRIVER
  M:    Hans de Goede <hdegoede@redhat.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel_atomisp2_led.c
 +F:    drivers/platform/x86/intel/atomisp2/led.c
 +
 +INTEL BIOS SAR INT1092 DRIVER
 +M:    Shravan S <s.shravan@intel.com>
 +M:    Intel Corporation <linuxwwan@intel.com>
 +L:    platform-driver-x86@vger.kernel.org
 +S:    Maintained
 +F:    drivers/platform/x86/intel/int1092/
  
  INTEL BROXTON PMC DRIVER
  M:    Mika Westerberg <mika.westerberg@linux.intel.com>
@@@ -9321,7 -9261,7 +9321,7 @@@ S:      Supporte
  W:    https://01.org/linuxgraphics/
  Q:    http://patchwork.freedesktop.org/project/intel-gfx/
  B:    https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs
 -C:    irc://chat.freenode.net/intel-gfx
 +C:    irc://irc.oftc.net/intel-gfx
  T:    git git://anongit.freedesktop.org/drm-intel
  F:    Documentation/gpu/i915.rst
  F:    drivers/gpu/drm/i915/
@@@ -9385,7 -9325,7 +9385,7 @@@ INTEL HID EVENT DRIVE
  M:    Alex Hung <alex.hung@canonical.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel-hid.c
 +F:    drivers/platform/x86/intel/hid.c
  
  INTEL I/OAT DMA DRIVER
  M:    Dave Jiang <dave.jiang@intel.com>
@@@ -9529,17 -9469,17 +9529,17 @@@ F:   include/linux/mfd/intel-m10-bmc.
  
  INTEL MENLOW THERMAL DRIVER
  M:    Sujith Thomas <sujith.thomas@intel.com>
 -L:    platform-driver-x86@vger.kernel.org
 +L:    linux-pm@vger.kernel.org
  S:    Supported
  W:    https://01.org/linux-acpi
 -F:    drivers/platform/x86/intel_menlow.c
 +F:    drivers/thermal/intel/intel_menlow.c
  
  INTEL P-Unit IPC DRIVER
  M:    Zha Qipeng <qipeng.zha@intel.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    arch/x86/include/asm/intel_punit_ipc.h
 -F:    drivers/platform/x86/intel_punit_ipc.c
 +F:    drivers/platform/x86/intel/punit_ipc.c
  
  INTEL PMC CORE DRIVER
  M:    Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
@@@ -9547,7 -9487,7 +9547,7 @@@ M:      David E Box <david.e.box@intel.com
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-platform-intel-pmc
 -F:    drivers/platform/x86/intel_pmc_core*
 +F:    drivers/platform/x86/intel/pmc/
  
  INTEL PMIC GPIO DRIVERS
  M:    Andy Shevchenko <andy@kernel.org>
@@@ -9565,7 -9505,7 +9565,7 @@@ INTEL PMT DRIVE
  M:    "David E. Box" <david.e.box@linux.intel.com>
  S:    Maintained
  F:    drivers/mfd/intel_pmt.c
 -F:    drivers/platform/x86/intel_pmt_*
 +F:    drivers/platform/x86/intel/pmt/
  
  INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
  M:    Stanislav Yakovlev <stas.yakovlev@gmail.com>
@@@ -9602,7 -9542,7 +9602,7 @@@ INTEL SPEED SELECT TECHNOLOG
  M:    Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel_speed_select_if/
 +F:    drivers/platform/x86/intel/speed_select_if/
  F:    include/uapi/linux/isst_if.h
  F:    tools/power/x86/intel-speed-select/
  
@@@ -9623,19 -9563,19 +9623,19 @@@ M:   "David E. Box" <david.e.box@linux.in
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    arch/x86/include/asm/intel_telemetry.h
 -F:    drivers/platform/x86/intel_telemetry*
 +F:    drivers/platform/x86/intel/telemetry/
  
  INTEL UNCORE FREQUENCY CONTROL
  M:    Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel-uncore-frequency.c
 +F:    drivers/platform/x86/intel/uncore-frequency.c
  
  INTEL VIRTUAL BUTTON DRIVER
  M:    AceLan Kao <acelan.kao@canonical.com>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
 -F:    drivers/platform/x86/intel-vbtn.c
 +F:    drivers/platform/x86/intel/vbtn.c
  
  INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy)
  M:    Stanislaw Gruszka <stf_xl@wp.pl>
@@@ -9656,12 -9596,12 +9656,12 @@@ M:   Jithu Joseph <jithu.joseph@intel.com
  R:    Maurice Ma <maurice.ma@intel.com>
  S:    Maintained
  W:    https://slimbootloader.github.io/security/firmware-update.html
 -F:    drivers/platform/x86/intel-wmi-sbl-fw-update.c
 +F:    drivers/platform/x86/intel/wmi/sbl-fw-update.c
  
  INTEL WMI THUNDERBOLT FORCE POWER DRIVER
  L:    Dell.Client.Kernel@dell.com
  S:    Maintained
 -F:    drivers/platform/x86/intel-wmi-thunderbolt.c
 +F:    drivers/platform/x86/intel/wmi/thunderbolt.c
  
  INTEL WWAN IOSM DRIVER
  M:    M Chetan Kumar <m.chetan.kumar@intel.com>
@@@ -9819,6 -9759,11 +9819,6 @@@ M:     David Sterba <dsterba@suse.com
  S:    Odd Fixes
  F:    drivers/tty/ipwireless/
  
 -IPX NETWORK LAYER
 -L:    netdev@vger.kernel.org
 -S:    Obsolete
 -F:    include/uapi/linux/ipx.h
 -
  IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
  M:    Marc Zyngier <maz@kernel.org>
  S:    Maintained
@@@ -10117,7 -10062,6 +10117,7 @@@ F:   fs/autofs
  KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
  M:    Masahiro Yamada <masahiroy@kernel.org>
  M:    Michal Marek <michal.lkml@markovi.net>
 +R:    Nick Desaulniers <ndesaulniers@google.com>
  L:    linux-kbuild@vger.kernel.org
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
@@@ -10169,17 -10113,6 +10169,17 @@@ T: git git://git.kernel.org/pub/scm/lin
  F:    Documentation/dev-tools/kselftest*
  F:    tools/testing/selftests/
  
 +KERNEL SMB3 SERVER (KSMBD)
 +M:    Namjae Jeon <linkinjeon@kernel.org>
 +M:    Sergey Senozhatsky <senozhatsky@chromium.org>
 +M:    Steve French <sfrench@samba.org>
 +M:    Hyunchul Lee <hyc.lee@gmail.com>
 +L:    linux-cifs@vger.kernel.org
 +S:    Maintained
 +T:    git git://git.samba.org/ksmbd.git
 +F:    fs/cifs_common/
 +F:    fs/ksmbd/
 +
  KERNEL UNIT TESTING FRAMEWORK (KUnit)
  M:    Brendan Higgins <brendanhiggins@google.com>
  L:    linux-kselftest@vger.kernel.org
@@@ -10465,7 -10398,6 +10465,7 @@@ F:   net/core/skmsg.
  F:    net/core/sock_map.c
  F:    net/ipv4/tcp_bpf.c
  F:    net/ipv4/udp_bpf.c
 +F:    net/unix/unix_bpf.c
  
  LANDLOCK SECURITY MODULE
  M:    Mickaël Salaün <mic@digikod.net>
@@@ -10687,6 -10619,15 +10687,6 @@@ F:  LICENSES
  F:    scripts/spdxcheck-test.sh
  F:    scripts/spdxcheck.py
  
 -LIGHTNVM PLATFORM SUPPORT
 -M:    Matias Bjorling <mb@lightnvm.io>
 -L:    linux-block@vger.kernel.org
 -S:    Maintained
 -W:    http://github/OpenChannelSSD
 -F:    drivers/lightnvm/
 -F:    include/linux/lightnvm.h
 -F:    include/uapi/linux/lightnvm.h
 -
  LINEAR RANGES HELPERS
  M:    Mark Brown <broonie@kernel.org>
  R:    Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
@@@ -11099,18 -11040,6 +11099,18 @@@ F: drivers/mailbox/arm_mhuv2.
  F:    include/linux/mailbox/arm_mhuv2_message.h
  F:    Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
  
 +MANAGEMENT COMPONENT TRANSPORT PROTOCOL (MCTP)
 +M:    Jeremy Kerr <jk@codeconstruct.com.au>
 +M:    Matt Johnston <matt@codeconstruct.com.au>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/networking/mctp.rst
 +F:    drivers/net/mctp/
 +F:    include/net/mctp.h
 +F:    include/net/mctpdevice.h
 +F:    include/net/netns/mctp.h
 +F:    net/mctp/
 +
  MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
  M:    Michael Kerrisk <mtk.manpages@gmail.com>
  L:    linux-man@vger.kernel.org
@@@ -11121,7 -11050,7 +11121,7 @@@ MARDUK (CREATOR CI40) DEVICE TREE SUPPO
  M:    Rahul Bedarkar <rahulbedarkar89@gmail.com>
  L:    linux-mips@vger.kernel.org
  S:    Maintained
 -F:    arch/mips/boot/dts/img/pistachio_marduk.dts
 +F:    arch/mips/boot/dts/img/pistachio*
  
  MARVELL 88E6XXX ETHERNET SWITCH FABRIC DRIVER
  M:    Andrew Lunn <andrew@lunn.ch>
@@@ -11408,12 -11337,6 +11408,12 @@@ W: https://linuxtv.or
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/radio/radio-maxiradio*
  
 +MAXLINEAR ETHERNET PHY DRIVER
 +M:    Xu Liang <lxu@maxlinear.com>
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +F:    drivers/net/phy/mxl-gpy.c
 +
  MCBA MICROCHIP CAN BUS ANALYZER TOOL DRIVER
  R:    Yasushi SHOJI <yashi@spacecubics.com>
  L:    linux-can@vger.kernel.org
@@@ -13340,6 -13263,15 +13340,15 @@@ T: git git://git.kernel.org/pub/scm/lin
  F:    Documentation/filesystems/ntfs.rst
  F:    fs/ntfs/
  
+ NTFS3 FILESYSTEM
+ M:    Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+ L:    ntfs3@lists.linux.dev
+ S:    Supported
+ W:    http://www.paragon-software.com/
+ T:    git https://github.com/Paragon-Software-Group/linux-ntfs3.git
+ F:    Documentation/filesystems/ntfs3.rst
+ F:    fs/ntfs3/
  NUBUS SUBSYSTEM
  M:    Finn Thain <fthain@linux-m68k.org>
  L:    linux-m68k@lists.linux-m68k.org
@@@ -13867,15 -13799,6 +13876,15 @@@ T: git git://linuxtv.org/media_tree.gi
  F:    Documentation/devicetree/bindings/media/i2c/ov8856.yaml
  F:    drivers/media/i2c/ov8856.c
  
 +OMNIVISION OV9282 SENSOR DRIVER
 +M:    Paul J. Murphy <paul.j.murphy@intel.com>
 +M:    Daniele Alessandrelli <daniele.alessandrelli@intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml
 +F:    drivers/media/i2c/ov9282.c
 +
  OMNIVISION OV9640 SENSOR DRIVER
  M:    Petr Cvek <petrcvekcz@gmail.com>
  L:    linux-media@vger.kernel.org
@@@ -13966,12 -13889,6 +13975,12 @@@ F: Documentation/devicetree
  F:    arch/*/boot/dts/
  F:    include/dt-bindings/
  
 +OPENCOMPUTE PTP CLOCK DRIVER
 +M:    Jonathan Lemon <jonathan.lemon@gmail.com>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/ptp/ptp_ocp.c
 +
  OPENCORES I2C BUS DRIVER
  M:    Peter Korsgaard <peter@korsgaard.com>
  M:    Andrew Lunn <andrew@lunn.ch>
@@@ -14297,7 -14214,7 +14306,7 @@@ M:   Lucas Stach <l.stach@pengutronix.de
  L:    linux-pci@vger.kernel.org
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
 +F:    Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
  F:    drivers/pci/controller/dwc/*imx6*
  
  PCI DRIVER FOR FU740
@@@ -14385,8 -14302,7 +14394,8 @@@ M:   Jingoo Han <jingoohan1@gmail.com
  M:    Gustavo Pimentel <gustavo.pimentel@synopsys.com>
  L:    linux-pci@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pci/designware-pcie.txt
 +F:    Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml
 +F:    Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml
  F:    drivers/pci/controller/dwc/*designware*
  
  PCI DRIVER FOR TI DRA7XX/J721E
@@@ -14523,7 -14439,7 +14532,7 @@@ M:   Xiaowei Song <songxiaowei@hisilicon.
  M:    Binghui Wang <wangbinghui@hisilicon.com>
  L:    linux-pci@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pci/kirin-pcie.txt
 +F:    Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml
  F:    drivers/pci/controller/dwc/pcie-kirin.c
  
  PCIE DRIVER FOR HISILICON STB
@@@ -14735,12 -14651,6 +14744,12 @@@ F: Documentation/driver-api/pin-control
  F:    drivers/pinctrl/
  F:    include/linux/pinctrl/
  
 +PIN CONTROLLER - AMD
 +M:    Basavaraj Natikar <Basavaraj.Natikar@amd.com>
 +M:    Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
 +S:    Maintained
 +F:    drivers/pinctrl/pinctrl-amd.c
 +
  PIN CONTROLLER - FREESCALE
  M:    Dong Aisheng <aisheng.dong@nxp.com>
  M:    Fabio Estevam <festevam@gmail.com>
@@@ -14759,19 -14669,12 +14768,19 @@@ S:        Maintaine
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git
  F:    drivers/pinctrl/intel/
  
 +PIN CONTROLLER - KEEMBAY
 +M:    Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>
 +S:    Supported
 +F:    drivers/pinctrl/pinctrl-keembay*
 +
  PIN CONTROLLER - MEDIATEK
  M:    Sean Wang <sean.wang@kernel.org>
  L:    linux-mediatek@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
 -F:    Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt6797-pinctrl.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/mediatek,mt8183-pinctrl.yaml
  F:    drivers/pinctrl/mediatek/
  
  PIN CONTROLLER - MICROCHIP AT91
@@@ -14825,6 -14728,14 +14834,6 @@@ S:  Maintaine
  W:    http://www.st.com/spear
  F:    drivers/pinctrl/spear/
  
 -PISTACHIO SOC SUPPORT
 -M:    James Hartley <james.hartley@sondrel.com>
 -L:    linux-mips@vger.kernel.org
 -S:    Odd Fixes
 -F:    arch/mips/boot/dts/img/pistachio*
 -F:    arch/mips/configs/pistachio*_defconfig
 -F:    arch/mips/pistachio/
 -
  PKTCDVD DRIVER
  M:    linux-block@vger.kernel.org
  S:    Orphan
@@@ -15041,10 -14952,12 +15050,10 @@@ S:        Maintaine
  F:    include/linux/printk.h
  F:    kernel/printk/
  
 -PRISM54 WIRELESS DRIVER
 -M:    Luis Chamberlain <mcgrof@kernel.org>
 -L:    linux-wireless@vger.kernel.org
 -S:    Obsolete
 -W:    https://wireless.wiki.kernel.org/en/users/Drivers/p54
 -F:    drivers/net/wireless/intersil/prism54/
 +PRINTK INDEXING
 +R:    Chris Down <chris@chrisdown.name>
 +S:    Maintained
 +F:    kernel/printk/index.c
  
  PROC FILESYSTEM
  L:    linux-kernel@vger.kernel.org
@@@ -15961,14 -15874,6 +15970,14 @@@ L: linux-renesas-soc@vger.kernel.or
  S:    Maintained
  F:    drivers/phy/renesas/phy-rcar-gen3-usb*.c
  
 +RENESAS RZ/G2L A/D DRIVER
 +M:    Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
 +L:    linux-iio@vger.kernel.org
 +L:    linux-renesas-soc@vger.kernel.org
 +S:    Supported
 +F:    Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
 +F:    drivers/iio/adc/rzg2l_adc.c
 +
  RESET CONTROLLER FRAMEWORK
  M:    Philipp Zabel <p.zabel@pengutronix.de>
  S:    Maintained
@@@ -16439,7 -16344,7 +16448,7 @@@ SAMSUNG EXYNOS TRUE RANDOM NUMBER GENER
  M:    Łukasz Stelmach <l.stelmach@samsung.com>
  L:    linux-samsung-soc@vger.kernel.org
  S:    Maintained
 -F:    Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
 +F:    Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
  F:    drivers/char/hw_random/exynos-trng.c
  
  SAMSUNG FRAMEBUFFER DRIVER
@@@ -16532,14 -16437,10 +16541,14 @@@ L:        linux-samsung-soc@vger.kernel.or
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk.git
  F:    Documentation/devicetree/bindings/clock/exynos*.txt
 +F:    Documentation/devicetree/bindings/clock/samsung,*.yaml
  F:    Documentation/devicetree/bindings/clock/samsung,s3c*
  F:    Documentation/devicetree/bindings/clock/samsung,s5p*
  F:    drivers/clk/samsung/
  F:    include/dt-bindings/clock/exynos*.h
 +F:    include/dt-bindings/clock/s3c*.h
 +F:    include/dt-bindings/clock/s5p*.h
 +F:    include/dt-bindings/clock/samsung,*.h
  F:    include/linux/clk/samsung.h
  F:    include/linux/platform_data/clk-s3c2410.h
  
@@@ -16581,12 -16482,6 +16590,12 @@@ F: drivers/phy/samsung/phy-s5pv210-usb2
  F:    drivers/phy/samsung/phy-samsung-usb2.c
  F:    drivers/phy/samsung/phy-samsung-usb2.h
  
 +SANCLOUD BEAGLEBONE ENHANCED DEVICE TREE
 +M:    Paul Barker <paul.barker@sancloud.com>
 +R:    Marc Murphy <marc.murphy@sancloud.com>
 +S:    Supported
 +F:    arch/arm/boot/dts/am335x-sancloud*
 +
  SC1200 WDT DRIVER
  M:    Zwane Mwaikambo <zwanem@gmail.com>
  S:    Maintained
@@@ -16846,12 -16741,6 +16855,12 @@@ F: drivers/iio/chemical/scd30_core.
  F:    drivers/iio/chemical/scd30_i2c.c
  F:    drivers/iio/chemical/scd30_serial.c
  
 +SENSIRION SGP40 GAS SENSOR DRIVER
 +M:    Andreas Klinger <ak@it-klinger.de>
 +S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-bus-iio-chemical-sgp40
 +F:    drivers/iio/chemical/sgp40.c
 +
  SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER
  M:    Tomasz Duszynski <tduszyns@gmail.com>
  S:    Maintained
@@@ -17430,15 -17319,6 +17439,15 @@@ T: git git://linuxtv.org/media_tree.gi
  F:    Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
  F:    drivers/media/i2c/imx334.c
  
 +SONY IMX335 SENSOR DRIVER
 +M:    Paul J. Murphy <paul.j.murphy@intel.com>
 +M:    Daniele Alessandrelli <daniele.alessandrelli@intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml
 +F:    drivers/media/i2c/imx335.c
 +
  SONY IMX355 SENSOR DRIVER
  M:    Tianshu Qiu <tian.shu.qiu@intel.com>
  L:    linux-media@vger.kernel.org
@@@ -17446,15 -17326,6 +17455,15 @@@ S: Maintaine
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/i2c/imx355.c
  
 +SONY IMX412 SENSOR DRIVER
 +M:    Paul J. Murphy <paul.j.murphy@intel.com>
 +M:    Daniele Alessandrelli <daniele.alessandrelli@intel.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml
 +F:    drivers/media/i2c/imx412.c
 +
  SONY MEMORYSTICK SUBSYSTEM
  M:    Maxim Levitsky <maximlevitsky@gmail.com>
  M:    Alex Dubov <oakad@yahoo.com>
@@@ -17774,9 -17645,8 +17783,9 @@@ F:   drivers/staging/olpc_dcon
  
  STAGING - REALTEK RTL8188EU DRIVERS
  M:    Larry Finger <Larry.Finger@lwfinger.net>
 -S:    Odd Fixes
 -F:    drivers/staging/rtl8188eu/
 +M:    Phillip Potter <phil@philpotter.co.uk>
 +S:    Supported
 +F:    drivers/staging/r8188eu/
  
  STAGING - REALTEK RTL8712U DRIVERS
  M:    Larry Finger <Larry.Finger@lwfinger.net>
@@@ -18113,7 -17983,6 +18122,7 @@@ F:   drivers/regulator/scmi-regulator.
  F:    drivers/reset/reset-scmi.c
  F:    include/linux/sc[mp]i_protocol.h
  F:    include/trace/events/scmi.h
 +F:    include/uapi/linux/virtio_scmi.h
  
  SYSTEM RESET/SHUTDOWN DRIVERS
  M:    Sebastian Reichel <sre@kernel.org>
@@@ -18964,14 -18833,6 +18973,14 @@@ F: arch/x86/mm/testmmiotrace.
  F:    include/linux/mmiotrace.h
  F:    kernel/trace/trace_mmiotrace.c
  
 +TRADITIONAL CHINESE DOCUMENTATION
 +M:    Hu Haowen <src.res@email.cn>
 +L:    linux-doc-tw-discuss@lists.sourceforge.net
 +S:    Maintained
 +W:    https://github.com/srcres258/linux-doc
 +T:    git git://github.com/srcres258/linux-doc.git doc-zh-tw
 +F:    Documentation/translations/zh_TW/
 +
  TRIVIAL PATCHES
  M:    Jiri Kosina <trivial@kernel.org>
  S:    Maintained
@@@ -19631,7 -19492,6 +19640,7 @@@ T:   git git://github.com/awilliam/linux-
  F:    Documentation/driver-api/vfio.rst
  F:    drivers/vfio/
  F:    include/linux/vfio.h
 +F:    include/linux/vfio_pci_core.h
  F:    include/uapi/linux/vfio.h
  
  VFIO FSL-MC DRIVER
@@@ -19882,15 -19742,6 +19891,15 @@@ S: Maintaine
  F:    include/uapi/linux/virtio_snd.h
  F:    sound/virtio/*
  
 +VIRTIO I2C DRIVER
 +M:    Jie Deng <jie.deng@intel.com>
 +M:    Viresh Kumar <viresh.kumar@linaro.org>
 +L:    linux-i2c@vger.kernel.org
 +L:    virtualization@lists.linux-foundation.org
 +S:    Maintained
 +F:    drivers/i2c/busses/i2c-virtio.c
 +F:    include/uapi/linux/virtio_i2c.h
 +
  VIRTUAL BOX GUEST DEVICE DRIVER
  M:    Hans de Goede <hdegoede@redhat.com>
  M:    Arnd Bergmann <arnd@arndb.de>
diff --combined fs/Kconfig
@@@ -101,6 -101,16 +101,6 @@@ config FILE_LOCKIN
            for filesystems like NFS and for the flock() system
            call. Disabling this option saves about 11k.
  
 -config MANDATORY_FILE_LOCKING
 -      bool "Enable Mandatory file locking"
 -      depends on FILE_LOCKING
 -      default y
 -      help
 -        This option enables files appropriately marked files on appropriely
 -        mounted filesystems to support mandatory locking.
 -
 -        To the best of my knowledge this is dead code that no one cares about.
 -
  source "fs/crypto/Kconfig"
  
  source "fs/verity/Kconfig"
@@@ -136,6 -146,7 +136,7 @@@ menu "DOS/FAT/EXFAT/NT Filesystems
  source "fs/fat/Kconfig"
  source "fs/exfat/Kconfig"
  source "fs/ntfs/Kconfig"
+ source "fs/ntfs3/Kconfig"
  
  endmenu
  endif # BLOCK
@@@ -348,15 -359,7 +349,15 @@@ config NFS_V4_2_SSC_HELPE
  
  source "net/sunrpc/Kconfig"
  source "fs/ceph/Kconfig"
 +
  source "fs/cifs/Kconfig"
 +source "fs/ksmbd/Kconfig"
 +
 +config CIFS_COMMON
 +      tristate
 +      default y if CIFS=y
 +      default m if CIFS=m
 +
  source "fs/coda/Kconfig"
  source "fs/afs/Kconfig"
  source "fs/9p/Kconfig"
diff --combined fs/Makefile
@@@ -96,11 -96,10 +96,12 @@@ obj-$(CONFIG_LOCKD)                += lockd
  obj-$(CONFIG_NLS)             += nls/
  obj-$(CONFIG_UNICODE)         += unicode/
  obj-$(CONFIG_SYSV_FS)         += sysv/
 +obj-$(CONFIG_CIFS_COMMON)     += cifs_common/
  obj-$(CONFIG_CIFS)            += cifs/
 +obj-$(CONFIG_SMB_SERVER)      += ksmbd/
  obj-$(CONFIG_HPFS_FS)         += hpfs/
  obj-$(CONFIG_NTFS_FS)         += ntfs/
+ obj-$(CONFIG_NTFS3_FS)                += ntfs3/
  obj-$(CONFIG_UFS_FS)          += ufs/
  obj-$(CONFIG_EFS_FS)          += efs/
  obj-$(CONFIG_JFFS2_FS)                += jffs2/
diff --combined fs/ntfs3/ntfs_fs.h
index 0000000,97e682e..dc71c59
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1111 +1,1111 @@@
 -struct posix_acl *ntfs_get_acl(struct inode *inode, int type);
+ /* SPDX-License-Identifier: GPL-2.0 */
+ /*
+  *
+  * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
+  *
+  */
+ // clang-format off
+ #ifndef _LINUX_NTFS3_NTFS_FS_H
+ #define _LINUX_NTFS3_NTFS_FS_H
+ #define MINUS_ONE_T                   ((size_t)(-1))
+ /* Biggest MFT / smallest cluster */
+ #define MAXIMUM_BYTES_PER_MFT         4096
+ #define NTFS_BLOCKS_PER_MFT_RECORD    (MAXIMUM_BYTES_PER_MFT / 512)
+ #define MAXIMUM_BYTES_PER_INDEX               4096
+ #define NTFS_BLOCKS_PER_INODE         (MAXIMUM_BYTES_PER_INDEX / 512)
+ /* NTFS specific error code when fixup failed. */
+ #define E_NTFS_FIXUP                  555
+ /* NTFS specific error code about resident->nonresident. */
+ #define E_NTFS_NONRESIDENT            556
+ /* NTFS specific error code about punch hole. */
+ #define E_NTFS_NOTALIGNED             557
+ /* sbi->flags */
+ #define NTFS_FLAGS_NODISCARD          0x00000001
+ /* Set when LogFile is replaying. */
+ #define NTFS_FLAGS_LOG_REPLAYING      0x00000008
+ /* Set when we changed first MFT's which copy must be updated in $MftMirr. */
+ #define NTFS_FLAGS_MFTMIRR            0x00001000
+ #define NTFS_FLAGS_NEED_REPLAY                0x04000000
+ /* ni->ni_flags */
+ /*
+  * Data attribute is external compressed (LZX/Xpress)
+  * 1 - WOF_COMPRESSION_XPRESS4K
+  * 2 - WOF_COMPRESSION_XPRESS8K
+  * 3 - WOF_COMPRESSION_XPRESS16K
+  * 4 - WOF_COMPRESSION_LZX32K
+  */
+ #define NI_FLAG_COMPRESSED_MASK               0x0000000f
+ /* Data attribute is deduplicated. */
+ #define NI_FLAG_DEDUPLICATED          0x00000010
+ #define NI_FLAG_EA                    0x00000020
+ #define NI_FLAG_DIR                   0x00000040
+ #define NI_FLAG_RESIDENT              0x00000080
+ #define NI_FLAG_UPDATE_PARENT         0x00000100
+ // clang-format on
+ struct ntfs_mount_options {
+       struct nls_table *nls;
+       kuid_t fs_uid;
+       kgid_t fs_gid;
+       u16 fs_fmask_inv;
+       u16 fs_dmask_inv;
+       unsigned uid : 1, /* uid was set. */
+               gid : 1, /* gid was set. */
+               fmask : 1, /* fmask was set. */
+               dmask : 1, /* dmask was set. */
+               sys_immutable : 1, /* Immutable system files. */
+               discard : 1, /* Issue discard requests on deletions. */
+               sparse : 1, /* Create sparse files. */
+               showmeta : 1, /* Show meta files. */
+               nohidden : 1, /* Do not show hidden files. */
+               force : 1, /* Rw mount dirty volume. */
+               no_acs_rules : 1, /*Exclude acs rules. */
+               prealloc : 1 /* Preallocate space when file is growing. */
+               ;
+ };
+ /* Special value to unpack and deallocate. */
+ #define RUN_DEALLOCATE ((struct runs_tree *)(size_t)1)
+ /* TODO: Use rb tree instead of array. */
+ struct runs_tree {
+       struct ntfs_run *runs;
+       size_t count; /* Currently used size a ntfs_run storage. */
+       size_t allocated; /* Currently allocated ntfs_run storage size. */
+ };
+ struct ntfs_buffers {
+       /* Biggest MFT / smallest cluster = 4096 / 512 = 8 */
+       /* Biggest index / smallest cluster = 4096 / 512 = 8 */
+       struct buffer_head *bh[PAGE_SIZE >> SECTOR_SHIFT];
+       u32 bytes;
+       u32 nbufs;
+       u32 off;
+ };
+ enum ALLOCATE_OPT {
+       ALLOCATE_DEF = 0, // Allocate all clusters.
+       ALLOCATE_MFT = 1, // Allocate for MFT.
+ };
+ enum bitmap_mutex_classes {
+       BITMAP_MUTEX_CLUSTERS = 0,
+       BITMAP_MUTEX_MFT = 1,
+ };
+ struct wnd_bitmap {
+       struct super_block *sb;
+       struct rw_semaphore rw_lock;
+       struct runs_tree run;
+       size_t nbits;
+       size_t total_zeroes; // Total number of free bits.
+       u16 *free_bits; // Free bits in each window.
+       size_t nwnd;
+       u32 bits_last; // Bits in last window.
+       struct rb_root start_tree; // Extents, sorted by 'start'.
+       struct rb_root count_tree; // Extents, sorted by 'count + start'.
+       size_t count; // Extents count.
+       /*
+        * -1 Tree is activated but not updated (too many fragments).
+        * 0 - Tree is not activated.
+        * 1 - Tree is activated and updated.
+        */
+       int uptodated;
+       size_t extent_min; // Minimal extent used while building.
+       size_t extent_max; // Upper estimate of biggest free block.
+       /* Zone [bit, end) */
+       size_t zone_bit;
+       size_t zone_end;
+       bool set_tail; // Not necessary in driver.
+       bool inited;
+ };
+ typedef int (*NTFS_CMP_FUNC)(const void *key1, size_t len1, const void *key2,
+                            size_t len2, const void *param);
+ enum index_mutex_classed {
+       INDEX_MUTEX_I30 = 0,
+       INDEX_MUTEX_SII = 1,
+       INDEX_MUTEX_SDH = 2,
+       INDEX_MUTEX_SO = 3,
+       INDEX_MUTEX_SQ = 4,
+       INDEX_MUTEX_SR = 5,
+       INDEX_MUTEX_TOTAL
+ };
+ /* ntfs_index - Allocation unit inside directory. */
+ struct ntfs_index {
+       struct runs_tree bitmap_run;
+       struct runs_tree alloc_run;
+       /* read/write access to 'bitmap_run'/'alloc_run' while ntfs_readdir */
+       struct rw_semaphore run_lock;
+       /*TODO: Remove 'cmp'. */
+       NTFS_CMP_FUNC cmp;
+       u8 index_bits; // log2(root->index_block_size)
+       u8 idx2vbn_bits; // log2(root->index_block_clst)
+       u8 vbn2vbo_bits; // index_block_size < cluster? 9 : cluster_bits
+       u8 type; // index_mutex_classed
+ };
+ /* Minimum MFT zone. */
+ #define NTFS_MIN_MFT_ZONE 100
+ /* Ntfs file system in-core superblock data. */
+ struct ntfs_sb_info {
+       struct super_block *sb;
+       u32 discard_granularity;
+       u64 discard_granularity_mask_inv; // ~(discard_granularity_mask_inv-1)
+       u32 cluster_size; // bytes per cluster
+       u32 cluster_mask; // == cluster_size - 1
+       u64 cluster_mask_inv; // ~(cluster_size - 1)
+       u32 block_mask; // sb->s_blocksize - 1
+       u32 blocks_per_cluster; // cluster_size / sb->s_blocksize
+       u32 record_size;
+       u32 sector_size;
+       u32 index_size;
+       u8 sector_bits;
+       u8 cluster_bits;
+       u8 record_bits;
+       u64 maxbytes; // Maximum size for normal files.
+       u64 maxbytes_sparse; // Maximum size for sparse file.
+       u32 flags; // See NTFS_FLAGS_XXX.
+       CLST bad_clusters; // The count of marked bad clusters.
+       u16 max_bytes_per_attr; // Maximum attribute size in record.
+       u16 attr_size_tr; // Attribute size threshold (320 bytes).
+       /* Records in $Extend. */
+       CLST objid_no;
+       CLST quota_no;
+       CLST reparse_no;
+       CLST usn_jrnl_no;
+       struct ATTR_DEF_ENTRY *def_table; // Attribute definition table.
+       u32 def_entries;
+       u32 ea_max_size;
+       struct MFT_REC *new_rec;
+       u16 *upcase;
+       struct {
+               u64 lbo, lbo2;
+               struct ntfs_inode *ni;
+               struct wnd_bitmap bitmap; // $MFT::Bitmap
+               /*
+                * MFT records [11-24) used to expand MFT itself.
+                * They always marked as used in $MFT::Bitmap
+                * 'reserved_bitmap' contains real bitmap of these records.
+                */
+               ulong reserved_bitmap; // Bitmap of used records [11 - 24)
+               size_t next_free; // The next record to allocate from
+               size_t used; // MFT valid size in records.
+               u32 recs_mirr; // Number of records in MFTMirr
+               u8 next_reserved;
+               u8 reserved_bitmap_inited;
+       } mft;
+       struct {
+               struct wnd_bitmap bitmap; // $Bitmap::Data
+               CLST next_free_lcn;
+       } used;
+       struct {
+               u64 size; // In bytes.
+               u64 blocks; // In blocks.
+               u64 ser_num;
+               struct ntfs_inode *ni;
+               __le16 flags; // Cached current VOLUME_INFO::flags, VOLUME_FLAG_DIRTY.
+               u8 major_ver;
+               u8 minor_ver;
+               char label[65];
+               bool real_dirty; // Real fs state.
+       } volume;
+       struct {
+               struct ntfs_index index_sii;
+               struct ntfs_index index_sdh;
+               struct ntfs_inode *ni;
+               u32 next_id;
+               u64 next_off;
+               __le32 def_security_id;
+       } security;
+       struct {
+               struct ntfs_index index_r;
+               struct ntfs_inode *ni;
+               u64 max_size; // 16K
+       } reparse;
+       struct {
+               struct ntfs_index index_o;
+               struct ntfs_inode *ni;
+       } objid;
+       struct {
+               struct mutex mtx_lznt;
+               struct lznt *lznt;
+ #ifdef CONFIG_NTFS3_LZX_XPRESS
+               struct mutex mtx_xpress;
+               struct xpress_decompressor *xpress;
+               struct mutex mtx_lzx;
+               struct lzx_decompressor *lzx;
+ #endif
+       } compress;
+       struct ntfs_mount_options options;
+       struct ratelimit_state msg_ratelimit;
+ };
+ /* One MFT record(usually 1024 bytes), consists of attributes. */
+ struct mft_inode {
+       struct rb_node node;
+       struct ntfs_sb_info *sbi;
+       struct MFT_REC *mrec;
+       struct ntfs_buffers nb;
+       CLST rno;
+       bool dirty;
+ };
+ /* Nested class for ntfs_inode::ni_lock. */
+ enum ntfs_inode_mutex_lock_class {
+       NTFS_INODE_MUTEX_DIRTY,
+       NTFS_INODE_MUTEX_SECURITY,
+       NTFS_INODE_MUTEX_OBJID,
+       NTFS_INODE_MUTEX_REPARSE,
+       NTFS_INODE_MUTEX_NORMAL,
+       NTFS_INODE_MUTEX_PARENT,
+ };
+ /*
+  * sturct ntfs_inode
+  *
+  * Ntfs inode - extends linux inode. consists of one or more MFT inodes.
+  */
+ struct ntfs_inode {
+       struct mft_inode mi; // base record
+       /*
+        * Valid size: [0 - i_valid) - these range in file contains valid data.
+        * Range [i_valid - inode->i_size) - contains 0.
+        * Usually i_valid <= inode->i_size.
+        */
+       u64 i_valid;
+       struct timespec64 i_crtime;
+       struct mutex ni_lock;
+       /* File attributes from std. */
+       enum FILE_ATTRIBUTE std_fa;
+       __le32 std_security_id;
+       /*
+        * Tree of mft_inode.
+        * Not empty when primary MFT record (usually 1024 bytes) can't save all attributes
+        * e.g. file becomes too fragmented or contains a lot of names.
+        */
+       struct rb_root mi_tree;
+       /*
+        * This member is used in ntfs_readdir to ensure that all subrecords are loaded
+        */
+       u8 mi_loaded;
+       union {
+               struct ntfs_index dir;
+               struct {
+                       struct rw_semaphore run_lock;
+                       struct runs_tree run;
+ #ifdef CONFIG_NTFS3_LZX_XPRESS
+                       struct page *offs_page;
+ #endif
+               } file;
+       };
+       struct {
+               struct runs_tree run;
+               struct ATTR_LIST_ENTRY *le; // 1K aligned memory.
+               size_t size;
+               bool dirty;
+       } attr_list;
+       size_t ni_flags; // NI_FLAG_XXX
+       struct inode vfs_inode;
+ };
+ struct indx_node {
+       struct ntfs_buffers nb;
+       struct INDEX_BUFFER *index;
+ };
+ struct ntfs_fnd {
+       int level;
+       struct indx_node *nodes[20];
+       struct NTFS_DE *de[20];
+       struct NTFS_DE *root_de;
+ };
+ enum REPARSE_SIGN {
+       REPARSE_NONE = 0,
+       REPARSE_COMPRESSED = 1,
+       REPARSE_DEDUPLICATED = 2,
+       REPARSE_LINK = 3
+ };
+ /* Functions from attrib.c */
+ int attr_load_runs(struct ATTRIB *attr, struct ntfs_inode *ni,
+                  struct runs_tree *run, const CLST *vcn);
+ int attr_allocate_clusters(struct ntfs_sb_info *sbi, struct runs_tree *run,
+                          CLST vcn, CLST lcn, CLST len, CLST *pre_alloc,
+                          enum ALLOCATE_OPT opt, CLST *alen, const size_t fr,
+                          CLST *new_lcn);
+ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
+                         struct ATTR_LIST_ENTRY *le, struct mft_inode *mi,
+                         u64 new_size, struct runs_tree *run,
+                         struct ATTRIB **ins_attr, struct page *page);
+ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type,
+                 const __le16 *name, u8 name_len, struct runs_tree *run,
+                 u64 new_size, const u64 *new_valid, bool keep_prealloc,
+                 struct ATTRIB **ret);
+ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
+                       CLST *len, bool *new);
+ int attr_data_read_resident(struct ntfs_inode *ni, struct page *page);
+ int attr_data_write_resident(struct ntfs_inode *ni, struct page *page);
+ int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
+                      const __le16 *name, u8 name_len, struct runs_tree *run,
+                      CLST vcn);
+ int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
+                        const __le16 *name, u8 name_len, struct runs_tree *run,
+                        u64 from, u64 to);
+ int attr_wof_frame_info(struct ntfs_inode *ni, struct ATTRIB *attr,
+                       struct runs_tree *run, u64 frame, u64 frames,
+                       u8 frame_bits, u32 *ondisk_size, u64 *vbo_data);
+ int attr_is_frame_compressed(struct ntfs_inode *ni, struct ATTRIB *attr,
+                            CLST frame, CLST *clst_data);
+ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size,
+                       u64 new_valid);
+ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes);
+ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size);
+ /* Functions from attrlist.c */
+ void al_destroy(struct ntfs_inode *ni);
+ bool al_verify(struct ntfs_inode *ni);
+ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr);
+ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni,
+                                    struct ATTR_LIST_ENTRY *le);
+ struct ATTR_LIST_ENTRY *al_find_le(struct ntfs_inode *ni,
+                                  struct ATTR_LIST_ENTRY *le,
+                                  const struct ATTRIB *attr);
+ struct ATTR_LIST_ENTRY *al_find_ex(struct ntfs_inode *ni,
+                                  struct ATTR_LIST_ENTRY *le,
+                                  enum ATTR_TYPE type, const __le16 *name,
+                                  u8 name_len, const CLST *vcn);
+ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name,
+             u8 name_len, CLST svcn, __le16 id, const struct MFT_REF *ref,
+             struct ATTR_LIST_ENTRY **new_le);
+ bool al_remove_le(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le);
+ bool al_delete_le(struct ntfs_inode *ni, enum ATTR_TYPE type, CLST vcn,
+                 const __le16 *name, size_t name_len,
+                 const struct MFT_REF *ref);
+ int al_update(struct ntfs_inode *ni);
+ static inline size_t al_aligned(size_t size)
+ {
+       return (size + 1023) & ~(size_t)1023;
+ }
+ /* Globals from bitfunc.c */
+ bool are_bits_clear(const ulong *map, size_t bit, size_t nbits);
+ bool are_bits_set(const ulong *map, size_t bit, size_t nbits);
+ size_t get_set_bits_ex(const ulong *map, size_t bit, size_t nbits);
+ /* Globals from dir.c */
+ int ntfs_utf16_to_nls(struct ntfs_sb_info *sbi, const struct le_str *uni,
+                     u8 *buf, int buf_len);
+ int ntfs_nls_to_utf16(struct ntfs_sb_info *sbi, const u8 *name, u32 name_len,
+                     struct cpu_str *uni, u32 max_ulen,
+                     enum utf16_endian endian);
+ struct inode *dir_search_u(struct inode *dir, const struct cpu_str *uni,
+                          struct ntfs_fnd *fnd);
+ bool dir_is_empty(struct inode *dir);
+ extern const struct file_operations ntfs_dir_operations;
+ /* Globals from file.c */
+ int ntfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
+                struct kstat *stat, u32 request_mask, u32 flags);
+ void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn,
+                        CLST len);
+ int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
+                 struct iattr *attr);
+ int ntfs_file_open(struct inode *inode, struct file *file);
+ int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len);
+ extern const struct inode_operations ntfs_special_inode_operations;
+ extern const struct inode_operations ntfs_file_inode_operations;
+ extern const struct file_operations ntfs_file_operations;
+ /* Globals from frecord.c */
+ void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi);
+ struct ATTR_STD_INFO *ni_std(struct ntfs_inode *ni);
+ struct ATTR_STD_INFO5 *ni_std5(struct ntfs_inode *ni);
+ void ni_clear(struct ntfs_inode *ni);
+ int ni_load_mi_ex(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi);
+ int ni_load_mi(struct ntfs_inode *ni, const struct ATTR_LIST_ENTRY *le,
+              struct mft_inode **mi);
+ struct ATTRIB *ni_find_attr(struct ntfs_inode *ni, struct ATTRIB *attr,
+                           struct ATTR_LIST_ENTRY **entry_o,
+                           enum ATTR_TYPE type, const __le16 *name,
+                           u8 name_len, const CLST *vcn,
+                           struct mft_inode **mi);
+ struct ATTRIB *ni_enum_attr_ex(struct ntfs_inode *ni, struct ATTRIB *attr,
+                              struct ATTR_LIST_ENTRY **le,
+                              struct mft_inode **mi);
+ struct ATTRIB *ni_load_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
+                           const __le16 *name, u8 name_len, CLST vcn,
+                           struct mft_inode **pmi);
+ int ni_load_all_mi(struct ntfs_inode *ni);
+ bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi);
+ int ni_remove_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
+                  const __le16 *name, size_t name_len, bool base_only,
+                  const __le16 *id);
+ int ni_create_attr_list(struct ntfs_inode *ni);
+ int ni_expand_list(struct ntfs_inode *ni);
+ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type,
+                         const __le16 *name, u8 name_len,
+                         const struct runs_tree *run, CLST svcn, CLST len,
+                         __le16 flags, struct ATTRIB **new_attr,
+                         struct mft_inode **mi);
+ int ni_insert_resident(struct ntfs_inode *ni, u32 data_size,
+                      enum ATTR_TYPE type, const __le16 *name, u8 name_len,
+                      struct ATTRIB **new_attr, struct mft_inode **mi,
+                      struct ATTR_LIST_ENTRY **le);
+ void ni_remove_attr_le(struct ntfs_inode *ni, struct ATTRIB *attr,
+                      struct mft_inode *mi, struct ATTR_LIST_ENTRY *le);
+ int ni_delete_all(struct ntfs_inode *ni);
+ struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni,
+                                    const struct cpu_str *uni,
+                                    const struct MFT_REF *home,
+                                    struct mft_inode **mi,
+                                    struct ATTR_LIST_ENTRY **entry);
+ struct ATTR_FILE_NAME *ni_fname_type(struct ntfs_inode *ni, u8 name_type,
+                                    struct mft_inode **mi,
+                                    struct ATTR_LIST_ENTRY **entry);
+ int ni_new_attr_flags(struct ntfs_inode *ni, enum FILE_ATTRIBUTE new_fa);
+ enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr,
+                                  void *buffer);
+ int ni_write_inode(struct inode *inode, int sync, const char *hint);
+ #define _ni_write_inode(i, w) ni_write_inode(i, w, __func__)
+ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo,
+             __u64 vbo, __u64 len);
+ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page);
+ int ni_decompress_file(struct ntfs_inode *ni);
+ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
+                 u32 pages_per_frame);
+ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
+                  u32 pages_per_frame);
+ int ni_remove_name(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
+                  struct NTFS_DE *de, struct NTFS_DE **de2, int *undo_step);
+ bool ni_remove_name_undo(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
+                        struct NTFS_DE *de, struct NTFS_DE *de2,
+                        int undo_step);
+ int ni_add_name(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
+               struct NTFS_DE *de);
+ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
+             struct ntfs_inode *ni, struct NTFS_DE *de, struct NTFS_DE *new_de,
+             bool *is_bad);
+ bool ni_is_dirty(struct inode *inode);
+ /* Globals from fslog.c */
+ int log_replay(struct ntfs_inode *ni, bool *initialized);
+ /* Globals from fsntfs.c */
+ bool ntfs_fix_pre_write(struct NTFS_RECORD_HEADER *rhdr, size_t bytes);
+ int ntfs_fix_post_read(struct NTFS_RECORD_HEADER *rhdr, size_t bytes,
+                      bool simple);
+ int ntfs_extend_init(struct ntfs_sb_info *sbi);
+ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi);
+ const struct ATTR_DEF_ENTRY *ntfs_query_def(struct ntfs_sb_info *sbi,
+                                           enum ATTR_TYPE Type);
+ int ntfs_look_for_free_space(struct ntfs_sb_info *sbi, CLST lcn, CLST len,
+                            CLST *new_lcn, CLST *new_len,
+                            enum ALLOCATE_OPT opt);
+ int ntfs_look_free_mft(struct ntfs_sb_info *sbi, CLST *rno, bool mft,
+                      struct ntfs_inode *ni, struct mft_inode **mi);
+ void ntfs_mark_rec_free(struct ntfs_sb_info *sbi, CLST rno);
+ int ntfs_clear_mft_tail(struct ntfs_sb_info *sbi, size_t from, size_t to);
+ int ntfs_refresh_zone(struct ntfs_sb_info *sbi);
+ int ntfs_update_mftmirr(struct ntfs_sb_info *sbi, int wait);
+ enum NTFS_DIRTY_FLAGS {
+       NTFS_DIRTY_CLEAR = 0,
+       NTFS_DIRTY_DIRTY = 1,
+       NTFS_DIRTY_ERROR = 2,
+ };
+ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty);
+ int ntfs_sb_read(struct super_block *sb, u64 lbo, size_t bytes, void *buffer);
+ int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes,
+                 const void *buffer, int wait);
+ int ntfs_sb_write_run(struct ntfs_sb_info *sbi, const struct runs_tree *run,
+                     u64 vbo, const void *buf, size_t bytes);
+ struct buffer_head *ntfs_bread_run(struct ntfs_sb_info *sbi,
+                                  const struct runs_tree *run, u64 vbo);
+ int ntfs_read_run_nb(struct ntfs_sb_info *sbi, const struct runs_tree *run,
+                    u64 vbo, void *buf, u32 bytes, struct ntfs_buffers *nb);
+ int ntfs_read_bh(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo,
+                struct NTFS_RECORD_HEADER *rhdr, u32 bytes,
+                struct ntfs_buffers *nb);
+ int ntfs_get_bh(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo,
+               u32 bytes, struct ntfs_buffers *nb);
+ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr,
+                 struct ntfs_buffers *nb, int sync);
+ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run,
+                  struct page **pages, u32 nr_pages, u64 vbo, u32 bytes,
+                  u32 op);
+ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run);
+ int ntfs_vbo_to_lbo(struct ntfs_sb_info *sbi, const struct runs_tree *run,
+                   u64 vbo, u64 *lbo, u64 *bytes);
+ struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST nRec,
+                                 bool dir);
+ extern const u8 s_default_security[0x50];
+ bool is_sd_valid(const struct SECURITY_DESCRIPTOR_RELATIVE *sd, u32 len);
+ int ntfs_security_init(struct ntfs_sb_info *sbi);
+ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id,
+                           struct SECURITY_DESCRIPTOR_RELATIVE **sd,
+                           size_t *size);
+ int ntfs_insert_security(struct ntfs_sb_info *sbi,
+                        const struct SECURITY_DESCRIPTOR_RELATIVE *sd,
+                        u32 size, __le32 *security_id, bool *inserted);
+ int ntfs_reparse_init(struct ntfs_sb_info *sbi);
+ int ntfs_objid_init(struct ntfs_sb_info *sbi);
+ int ntfs_objid_remove(struct ntfs_sb_info *sbi, struct GUID *guid);
+ int ntfs_insert_reparse(struct ntfs_sb_info *sbi, __le32 rtag,
+                       const struct MFT_REF *ref);
+ int ntfs_remove_reparse(struct ntfs_sb_info *sbi, __le32 rtag,
+                       const struct MFT_REF *ref);
+ void mark_as_free_ex(struct ntfs_sb_info *sbi, CLST lcn, CLST len, bool trim);
+ int run_deallocate(struct ntfs_sb_info *sbi, struct runs_tree *run, bool trim);
+ /* Globals from index.c */
+ int indx_used_bit(struct ntfs_index *indx, struct ntfs_inode *ni, size_t *bit);
+ void fnd_clear(struct ntfs_fnd *fnd);
+ static inline struct ntfs_fnd *fnd_get(void)
+ {
+       return kzalloc(sizeof(struct ntfs_fnd), GFP_NOFS);
+ }
+ static inline void fnd_put(struct ntfs_fnd *fnd)
+ {
+       if (fnd) {
+               fnd_clear(fnd);
+               kfree(fnd);
+       }
+ }
+ void indx_clear(struct ntfs_index *idx);
+ int indx_init(struct ntfs_index *indx, struct ntfs_sb_info *sbi,
+             const struct ATTRIB *attr, enum index_mutex_classed type);
+ struct INDEX_ROOT *indx_get_root(struct ntfs_index *indx, struct ntfs_inode *ni,
+                                struct ATTRIB **attr, struct mft_inode **mi);
+ int indx_read(struct ntfs_index *idx, struct ntfs_inode *ni, CLST vbn,
+             struct indx_node **node);
+ int indx_find(struct ntfs_index *indx, struct ntfs_inode *dir,
+             const struct INDEX_ROOT *root, const void *Key, size_t KeyLen,
+             const void *param, int *diff, struct NTFS_DE **entry,
+             struct ntfs_fnd *fnd);
+ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
+                  const struct INDEX_ROOT *root, struct NTFS_DE **entry,
+                  struct ntfs_fnd *fnd);
+ int indx_find_raw(struct ntfs_index *indx, struct ntfs_inode *ni,
+                 const struct INDEX_ROOT *root, struct NTFS_DE **entry,
+                 size_t *off, struct ntfs_fnd *fnd);
+ int indx_insert_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
+                     const struct NTFS_DE *new_de, const void *param,
+                     struct ntfs_fnd *fnd, bool undo);
+ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
+                     const void *key, u32 key_len, const void *param);
+ int indx_update_dup(struct ntfs_inode *ni, struct ntfs_sb_info *sbi,
+                   const struct ATTR_FILE_NAME *fname,
+                   const struct NTFS_DUP_INFO *dup, int sync);
+ /* Globals from inode.c */
+ struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref,
+                        const struct cpu_str *name);
+ int ntfs_set_size(struct inode *inode, u64 new_size);
+ int reset_log_file(struct inode *inode);
+ int ntfs_get_block(struct inode *inode, sector_t vbn,
+                  struct buffer_head *bh_result, int create);
+ int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc);
+ int ntfs_sync_inode(struct inode *inode);
+ int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
+                     struct inode *i2);
+ int inode_write_data(struct inode *inode, const void *data, size_t bytes);
+ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
+                               struct inode *dir, struct dentry *dentry,
+                               const struct cpu_str *uni, umode_t mode,
+                               dev_t dev, const char *symname, u32 size,
+                               struct ntfs_fnd *fnd);
+ int ntfs_link_inode(struct inode *inode, struct dentry *dentry);
+ int ntfs_unlink_inode(struct inode *dir, const struct dentry *dentry);
+ void ntfs_evict_inode(struct inode *inode);
+ extern const struct inode_operations ntfs_link_inode_operations;
+ extern const struct address_space_operations ntfs_aops;
+ extern const struct address_space_operations ntfs_aops_cmpr;
+ /* Globals from name_i.c */
+ int fill_name_de(struct ntfs_sb_info *sbi, void *buf, const struct qstr *name,
+                const struct cpu_str *uni);
+ struct dentry *ntfs3_get_parent(struct dentry *child);
+ extern const struct inode_operations ntfs_dir_inode_operations;
+ extern const struct inode_operations ntfs_special_inode_operations;
+ /* Globals from record.c */
+ int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi);
+ void mi_put(struct mft_inode *mi);
+ int mi_init(struct mft_inode *mi, struct ntfs_sb_info *sbi, CLST rno);
+ int mi_read(struct mft_inode *mi, bool is_mft);
+ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr);
+ // TODO: id?
+ struct ATTRIB *mi_find_attr(struct mft_inode *mi, struct ATTRIB *attr,
+                           enum ATTR_TYPE type, const __le16 *name,
+                           size_t name_len, const __le16 *id);
+ static inline struct ATTRIB *rec_find_attr_le(struct mft_inode *rec,
+                                             struct ATTR_LIST_ENTRY *le)
+ {
+       return mi_find_attr(rec, NULL, le->type, le_name(le), le->name_len,
+                           &le->id);
+ }
+ int mi_write(struct mft_inode *mi, int wait);
+ int mi_format_new(struct mft_inode *mi, struct ntfs_sb_info *sbi, CLST rno,
+                 __le16 flags, bool is_mft);
+ void mi_mark_free(struct mft_inode *mi);
+ struct ATTRIB *mi_insert_attr(struct mft_inode *mi, enum ATTR_TYPE type,
+                             const __le16 *name, u8 name_len, u32 asize,
+                             u16 name_off);
+ bool mi_remove_attr(struct ntfs_inode *ni, struct mft_inode *mi,
+                   struct ATTRIB *attr);
+ bool mi_resize_attr(struct mft_inode *mi, struct ATTRIB *attr, int bytes);
+ int mi_pack_runs(struct mft_inode *mi, struct ATTRIB *attr,
+                struct runs_tree *run, CLST len);
+ static inline bool mi_is_ref(const struct mft_inode *mi,
+                            const struct MFT_REF *ref)
+ {
+       if (le32_to_cpu(ref->low) != mi->rno)
+               return false;
+       if (ref->seq != mi->mrec->seq)
+               return false;
+ #ifdef CONFIG_NTFS3_64BIT_CLUSTER
+       return le16_to_cpu(ref->high) == (mi->rno >> 32);
+ #else
+       return !ref->high;
+ #endif
+ }
+ static inline void mi_get_ref(const struct mft_inode *mi, struct MFT_REF *ref)
+ {
+       ref->low = cpu_to_le32(mi->rno);
+ #ifdef CONFIG_NTFS3_64BIT_CLUSTER
+       ref->high = cpu_to_le16(mi->rno >> 32);
+ #else
+       ref->high = 0;
+ #endif
+       ref->seq = mi->mrec->seq;
+ }
+ /* Globals from run.c */
+ bool run_lookup_entry(const struct runs_tree *run, CLST vcn, CLST *lcn,
+                     CLST *len, size_t *index);
+ void run_truncate(struct runs_tree *run, CLST vcn);
+ void run_truncate_head(struct runs_tree *run, CLST vcn);
+ void run_truncate_around(struct runs_tree *run, CLST vcn);
+ bool run_lookup(const struct runs_tree *run, CLST vcn, size_t *Index);
+ bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len,
+                  bool is_mft);
+ bool run_collapse_range(struct runs_tree *run, CLST vcn, CLST len);
+ bool run_get_entry(const struct runs_tree *run, size_t index, CLST *vcn,
+                  CLST *lcn, CLST *len);
+ bool run_is_mapped_full(const struct runs_tree *run, CLST svcn, CLST evcn);
+ int run_pack(const struct runs_tree *run, CLST svcn, CLST len, u8 *run_buf,
+            u32 run_buf_size, CLST *packed_vcns);
+ int run_unpack(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
+              CLST svcn, CLST evcn, CLST vcn, const u8 *run_buf,
+              u32 run_buf_size);
+ #ifdef NTFS3_CHECK_FREE_CLST
+ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
+                 CLST svcn, CLST evcn, CLST vcn, const u8 *run_buf,
+                 u32 run_buf_size);
+ #else
+ #define run_unpack_ex run_unpack
+ #endif
+ int run_get_highest_vcn(CLST vcn, const u8 *run_buf, u64 *highest_vcn);
+ /* Globals from super.c */
+ void *ntfs_set_shared(void *ptr, u32 bytes);
+ void *ntfs_put_shared(void *ptr);
+ void ntfs_unmap_meta(struct super_block *sb, CLST lcn, CLST len);
+ int ntfs_discard(struct ntfs_sb_info *sbi, CLST Lcn, CLST Len);
+ /* Globals from bitmap.c*/
+ int __init ntfs3_init_bitmap(void);
+ void ntfs3_exit_bitmap(void);
+ void wnd_close(struct wnd_bitmap *wnd);
+ static inline size_t wnd_zeroes(const struct wnd_bitmap *wnd)
+ {
+       return wnd->total_zeroes;
+ }
+ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits);
+ int wnd_set_free(struct wnd_bitmap *wnd, size_t bit, size_t bits);
+ int wnd_set_used(struct wnd_bitmap *wnd, size_t bit, size_t bits);
+ bool wnd_is_free(struct wnd_bitmap *wnd, size_t bit, size_t bits);
+ bool wnd_is_used(struct wnd_bitmap *wnd, size_t bit, size_t bits);
+ /* Possible values for 'flags' 'wnd_find'. */
+ #define BITMAP_FIND_MARK_AS_USED 0x01
+ #define BITMAP_FIND_FULL 0x02
+ size_t wnd_find(struct wnd_bitmap *wnd, size_t to_alloc, size_t hint,
+               size_t flags, size_t *allocated);
+ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits);
+ void wnd_zone_set(struct wnd_bitmap *wnd, size_t Lcn, size_t Len);
+ int ntfs_trim_fs(struct ntfs_sb_info *sbi, struct fstrim_range *range);
+ /* Globals from upcase.c */
+ int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2,
+                  const u16 *upcase, bool bothcase);
+ int ntfs_cmp_names_cpu(const struct cpu_str *uni1, const struct le_str *uni2,
+                      const u16 *upcase, bool bothcase);
+ /* globals from xattr.c */
+ #ifdef CONFIG_NTFS3_FS_POSIX_ACL
++struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu);
+ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+                struct posix_acl *acl, int type);
+ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
+                 struct inode *dir);
+ #else
+ #define ntfs_get_acl NULL
+ #define ntfs_set_acl NULL
+ #endif
+ int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode);
+ int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
+                   int mask);
+ ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
+ extern const struct xattr_handler *ntfs_xattr_handlers[];
+ int ntfs_save_wsl_perm(struct inode *inode);
+ void ntfs_get_wsl_perm(struct inode *inode);
+ /* globals from lznt.c */
+ struct lznt *get_lznt_ctx(int level);
+ size_t compress_lznt(const void *uncompressed, size_t uncompressed_size,
+                    void *compressed, size_t compressed_size,
+                    struct lznt *ctx);
+ ssize_t decompress_lznt(const void *compressed, size_t compressed_size,
+                       void *uncompressed, size_t uncompressed_size);
+ static inline bool is_ntfs3(struct ntfs_sb_info *sbi)
+ {
+       return sbi->volume.major_ver >= 3;
+ }
+ /* (sb->s_flags & SB_ACTIVE) */
+ static inline bool is_mounted(struct ntfs_sb_info *sbi)
+ {
+       return !!sbi->sb->s_root;
+ }
+ static inline bool ntfs_is_meta_file(struct ntfs_sb_info *sbi, CLST rno)
+ {
+       return rno < MFT_REC_FREE || rno == sbi->objid_no ||
+              rno == sbi->quota_no || rno == sbi->reparse_no ||
+              rno == sbi->usn_jrnl_no;
+ }
+ static inline void ntfs_unmap_page(struct page *page)
+ {
+       kunmap(page);
+       put_page(page);
+ }
+ static inline struct page *ntfs_map_page(struct address_space *mapping,
+                                        unsigned long index)
+ {
+       struct page *page = read_mapping_page(mapping, index, NULL);
+       if (!IS_ERR(page)) {
+               kmap(page);
+               if (!PageError(page))
+                       return page;
+               ntfs_unmap_page(page);
+               return ERR_PTR(-EIO);
+       }
+       return page;
+ }
+ static inline size_t wnd_zone_bit(const struct wnd_bitmap *wnd)
+ {
+       return wnd->zone_bit;
+ }
+ static inline size_t wnd_zone_len(const struct wnd_bitmap *wnd)
+ {
+       return wnd->zone_end - wnd->zone_bit;
+ }
+ static inline void run_init(struct runs_tree *run)
+ {
+       run->runs = NULL;
+       run->count = 0;
+       run->allocated = 0;
+ }
+ static inline struct runs_tree *run_alloc(void)
+ {
+       return kzalloc(sizeof(struct runs_tree), GFP_NOFS);
+ }
+ static inline void run_close(struct runs_tree *run)
+ {
+       kvfree(run->runs);
+       memset(run, 0, sizeof(*run));
+ }
+ static inline void run_free(struct runs_tree *run)
+ {
+       if (run) {
+               kvfree(run->runs);
+               kfree(run);
+       }
+ }
+ static inline bool run_is_empty(struct runs_tree *run)
+ {
+       return !run->count;
+ }
+ /* NTFS uses quad aligned bitmaps. */
+ static inline size_t bitmap_size(size_t bits)
+ {
+       return ALIGN((bits + 7) >> 3, 8);
+ }
+ #define _100ns2seconds 10000000
+ #define SecondsToStartOf1970 0x00000002B6109100
+ #define NTFS_TIME_GRAN 100
+ /*
+  * kernel2nt - Converts in-memory kernel timestamp into nt time.
+  */
+ static inline __le64 kernel2nt(const struct timespec64 *ts)
+ {
+       // 10^7 units of 100 nanoseconds one second
+       return cpu_to_le64(_100ns2seconds *
+                                  (ts->tv_sec + SecondsToStartOf1970) +
+                          ts->tv_nsec / NTFS_TIME_GRAN);
+ }
+ /*
+  * nt2kernel - Converts on-disk nt time into kernel timestamp.
+  */
+ static inline void nt2kernel(const __le64 tm, struct timespec64 *ts)
+ {
+       u64 t = le64_to_cpu(tm) - _100ns2seconds * SecondsToStartOf1970;
+       // WARNING: do_div changes its first argument(!)
+       ts->tv_nsec = do_div(t, _100ns2seconds) * 100;
+       ts->tv_sec = t;
+ }
+ static inline struct ntfs_sb_info *ntfs_sb(struct super_block *sb)
+ {
+       return sb->s_fs_info;
+ }
+ /*
+  * ntfs_up_cluster - Align up on cluster boundary.
+  */
+ static inline u64 ntfs_up_cluster(const struct ntfs_sb_info *sbi, u64 size)
+ {
+       return (size + sbi->cluster_mask) & sbi->cluster_mask_inv;
+ }
+ /*
+  * ntfs_up_block - Align up on cluster boundary.
+  */
+ static inline u64 ntfs_up_block(const struct super_block *sb, u64 size)
+ {
+       return (size + sb->s_blocksize - 1) & ~(u64)(sb->s_blocksize - 1);
+ }
+ static inline CLST bytes_to_cluster(const struct ntfs_sb_info *sbi, u64 size)
+ {
+       return (size + sbi->cluster_mask) >> sbi->cluster_bits;
+ }
+ static inline u64 bytes_to_block(const struct super_block *sb, u64 size)
+ {
+       return (size + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
+ }
+ static inline struct buffer_head *ntfs_bread(struct super_block *sb,
+                                            sector_t block)
+ {
+       struct buffer_head *bh = sb_bread(sb, block);
+       if (bh)
+               return bh;
+       ntfs_err(sb, "failed to read volume at offset 0x%llx",
+                (u64)block << sb->s_blocksize_bits);
+       return NULL;
+ }
+ static inline struct ntfs_inode *ntfs_i(struct inode *inode)
+ {
+       return container_of(inode, struct ntfs_inode, vfs_inode);
+ }
+ static inline bool is_compressed(const struct ntfs_inode *ni)
+ {
+       return (ni->std_fa & FILE_ATTRIBUTE_COMPRESSED) ||
+              (ni->ni_flags & NI_FLAG_COMPRESSED_MASK);
+ }
+ static inline int ni_ext_compress_bits(const struct ntfs_inode *ni)
+ {
+       return 0xb + (ni->ni_flags & NI_FLAG_COMPRESSED_MASK);
+ }
+ /* Bits - 0xc, 0xd, 0xe, 0xf, 0x10 */
+ static inline void ni_set_ext_compress_bits(struct ntfs_inode *ni, u8 bits)
+ {
+       ni->ni_flags |= (bits - 0xb) & NI_FLAG_COMPRESSED_MASK;
+ }
+ static inline bool is_dedup(const struct ntfs_inode *ni)
+ {
+       return ni->ni_flags & NI_FLAG_DEDUPLICATED;
+ }
+ static inline bool is_encrypted(const struct ntfs_inode *ni)
+ {
+       return ni->std_fa & FILE_ATTRIBUTE_ENCRYPTED;
+ }
+ static inline bool is_sparsed(const struct ntfs_inode *ni)
+ {
+       return ni->std_fa & FILE_ATTRIBUTE_SPARSE_FILE;
+ }
+ static inline int is_resident(struct ntfs_inode *ni)
+ {
+       return ni->ni_flags & NI_FLAG_RESIDENT;
+ }
+ static inline void le16_sub_cpu(__le16 *var, u16 val)
+ {
+       *var = cpu_to_le16(le16_to_cpu(*var) - val);
+ }
+ static inline void le32_sub_cpu(__le32 *var, u32 val)
+ {
+       *var = cpu_to_le32(le32_to_cpu(*var) - val);
+ }
+ static inline void nb_put(struct ntfs_buffers *nb)
+ {
+       u32 i, nbufs = nb->nbufs;
+       if (!nbufs)
+               return;
+       for (i = 0; i < nbufs; i++)
+               put_bh(nb->bh[i]);
+       nb->nbufs = 0;
+ }
+ static inline void put_indx_node(struct indx_node *in)
+ {
+       if (!in)
+               return;
+       kfree(in->index);
+       nb_put(&in->nb);
+       kfree(in);
+ }
+ static inline void mi_clear(struct mft_inode *mi)
+ {
+       nb_put(&mi->nb);
+       kfree(mi->mrec);
+       mi->mrec = NULL;
+ }
+ static inline void ni_lock(struct ntfs_inode *ni)
+ {
+       mutex_lock_nested(&ni->ni_lock, NTFS_INODE_MUTEX_NORMAL);
+ }
+ static inline void ni_lock_dir(struct ntfs_inode *ni)
+ {
+       mutex_lock_nested(&ni->ni_lock, NTFS_INODE_MUTEX_PARENT);
+ }
+ static inline void ni_unlock(struct ntfs_inode *ni)
+ {
+       mutex_unlock(&ni->ni_lock);
+ }
+ static inline int ni_trylock(struct ntfs_inode *ni)
+ {
+       return mutex_trylock(&ni->ni_lock);
+ }
+ static inline int attr_load_runs_attr(struct ntfs_inode *ni,
+                                     struct ATTRIB *attr,
+                                     struct runs_tree *run, CLST vcn)
+ {
+       return attr_load_runs_vcn(ni, attr->type, attr_name(attr),
+                                 attr->name_len, run, vcn);
+ }
+ static inline void le64_sub_cpu(__le64 *var, u64 val)
+ {
+       *var = cpu_to_le64(le64_to_cpu(*var) - val);
+ }
+ #endif /* _LINUX_NTFS3_NTFS_FS_H */
diff --combined fs/ntfs3/xattr.c
index 0000000,b15d532..7282d85
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1119 +1,1122 @@@
 -struct posix_acl *ntfs_get_acl(struct inode *inode, int type)
+ // SPDX-License-Identifier: GPL-2.0
+ /*
+  *
+  * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
+  *
+  */
+ #include <linux/blkdev.h>
+ #include <linux/buffer_head.h>
+ #include <linux/fs.h>
+ #include <linux/nls.h>
+ #include <linux/posix_acl.h>
+ #include <linux/posix_acl_xattr.h>
+ #include <linux/xattr.h>
+ #include "debug.h"
+ #include "ntfs.h"
+ #include "ntfs_fs.h"
+ // clang-format off
+ #define SYSTEM_DOS_ATTRIB    "system.dos_attrib"
+ #define SYSTEM_NTFS_ATTRIB   "system.ntfs_attrib"
+ #define SYSTEM_NTFS_SECURITY "system.ntfs_security"
+ // clang-format on
+ static inline size_t unpacked_ea_size(const struct EA_FULL *ea)
+ {
+       return ea->size ? le32_to_cpu(ea->size)
+                       : ALIGN(struct_size(ea, name,
+                                           1 + ea->name_len +
+                                                   le16_to_cpu(ea->elength)),
+                               4);
+ }
+ static inline size_t packed_ea_size(const struct EA_FULL *ea)
+ {
+       return struct_size(ea, name,
+                          1 + ea->name_len + le16_to_cpu(ea->elength)) -
+              offsetof(struct EA_FULL, flags);
+ }
+ /*
+  * find_ea
+  *
+  * Assume there is at least one xattr in the list.
+  */
+ static inline bool find_ea(const struct EA_FULL *ea_all, u32 bytes,
+                          const char *name, u8 name_len, u32 *off)
+ {
+       *off = 0;
+       if (!ea_all || !bytes)
+               return false;
+       for (;;) {
+               const struct EA_FULL *ea = Add2Ptr(ea_all, *off);
+               u32 next_off = *off + unpacked_ea_size(ea);
+               if (next_off > bytes)
+                       return false;
+               if (ea->name_len == name_len &&
+                   !memcmp(ea->name, name, name_len))
+                       return true;
+               *off = next_off;
+               if (next_off >= bytes)
+                       return false;
+       }
+ }
+ /*
+  * ntfs_read_ea - Read all extended attributes.
+  * @ea:               New allocated memory.
+  * @info:     Pointer into resident data.
+  */
+ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
+                       size_t add_bytes, const struct EA_INFO **info)
+ {
+       int err;
+       struct ATTR_LIST_ENTRY *le = NULL;
+       struct ATTRIB *attr_info, *attr_ea;
+       void *ea_p;
+       u32 size;
+       static_assert(le32_to_cpu(ATTR_EA_INFO) < le32_to_cpu(ATTR_EA));
+       *ea = NULL;
+       *info = NULL;
+       attr_info =
+               ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, NULL);
+       attr_ea =
+               ni_find_attr(ni, attr_info, &le, ATTR_EA, NULL, 0, NULL, NULL);
+       if (!attr_ea || !attr_info)
+               return 0;
+       *info = resident_data_ex(attr_info, sizeof(struct EA_INFO));
+       if (!*info)
+               return -EINVAL;
+       /* Check Ea limit. */
+       size = le32_to_cpu((*info)->size);
+       if (size > ni->mi.sbi->ea_max_size)
+               return -EFBIG;
+       if (attr_size(attr_ea) > ni->mi.sbi->ea_max_size)
+               return -EFBIG;
+       /* Allocate memory for packed Ea. */
+       ea_p = kmalloc(size + add_bytes, GFP_NOFS);
+       if (!ea_p)
+               return -ENOMEM;
+       if (attr_ea->non_res) {
+               struct runs_tree run;
+               run_init(&run);
+               err = attr_load_runs(attr_ea, ni, &run, NULL);
+               if (!err)
+                       err = ntfs_read_run_nb(ni->mi.sbi, &run, 0, ea_p, size,
+                                              NULL);
+               run_close(&run);
+               if (err)
+                       goto out;
+       } else {
+               void *p = resident_data_ex(attr_ea, size);
+               if (!p) {
+                       err = -EINVAL;
+                       goto out;
+               }
+               memcpy(ea_p, p, size);
+       }
+       memset(Add2Ptr(ea_p, size), 0, add_bytes);
+       *ea = ea_p;
+       return 0;
+ out:
+       kfree(ea_p);
+       *ea = NULL;
+       return err;
+ }
+ /*
+  * ntfs_list_ea
+  *
+  * Copy a list of xattrs names into the buffer
+  * provided, or compute the buffer size required.
+  *
+  * Return:
+  * * Number of bytes used / required on
+  * * -ERRNO - on failure
+  */
+ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,
+                           size_t bytes_per_buffer)
+ {
+       const struct EA_INFO *info;
+       struct EA_FULL *ea_all = NULL;
+       const struct EA_FULL *ea;
+       u32 off, size;
+       int err;
+       size_t ret;
+       err = ntfs_read_ea(ni, &ea_all, 0, &info);
+       if (err)
+               return err;
+       if (!info || !ea_all)
+               return 0;
+       size = le32_to_cpu(info->size);
+       /* Enumerate all xattrs. */
+       for (ret = 0, off = 0; off < size; off += unpacked_ea_size(ea)) {
+               ea = Add2Ptr(ea_all, off);
+               if (buffer) {
+                       if (ret + ea->name_len + 1 > bytes_per_buffer) {
+                               err = -ERANGE;
+                               goto out;
+                       }
+                       memcpy(buffer + ret, ea->name, ea->name_len);
+                       buffer[ret + ea->name_len] = 0;
+               }
+               ret += ea->name_len + 1;
+       }
+ out:
+       kfree(ea_all);
+       return err ? err : ret;
+ }
+ static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len,
+                      void *buffer, size_t size, size_t *required)
+ {
+       struct ntfs_inode *ni = ntfs_i(inode);
+       const struct EA_INFO *info;
+       struct EA_FULL *ea_all = NULL;
+       const struct EA_FULL *ea;
+       u32 off, len;
+       int err;
+       if (!(ni->ni_flags & NI_FLAG_EA))
+               return -ENODATA;
+       if (!required)
+               ni_lock(ni);
+       len = 0;
+       if (name_len > 255) {
+               err = -ENAMETOOLONG;
+               goto out;
+       }
+       err = ntfs_read_ea(ni, &ea_all, 0, &info);
+       if (err)
+               goto out;
+       if (!info)
+               goto out;
+       /* Enumerate all xattrs. */
+       if (!find_ea(ea_all, le32_to_cpu(info->size), name, name_len, &off)) {
+               err = -ENODATA;
+               goto out;
+       }
+       ea = Add2Ptr(ea_all, off);
+       len = le16_to_cpu(ea->elength);
+       if (!buffer) {
+               err = 0;
+               goto out;
+       }
+       if (len > size) {
+               err = -ERANGE;
+               if (required)
+                       *required = len;
+               goto out;
+       }
+       memcpy(buffer, ea->name + ea->name_len + 1, len);
+       err = 0;
+ out:
+       kfree(ea_all);
+       if (!required)
+               ni_unlock(ni);
+       return err ? err : len;
+ }
+ static noinline int ntfs_set_ea(struct inode *inode, const char *name,
+                               size_t name_len, const void *value,
+                               size_t val_size, int flags, int locked)
+ {
+       struct ntfs_inode *ni = ntfs_i(inode);
+       struct ntfs_sb_info *sbi = ni->mi.sbi;
+       int err;
+       struct EA_INFO ea_info;
+       const struct EA_INFO *info;
+       struct EA_FULL *new_ea;
+       struct EA_FULL *ea_all = NULL;
+       size_t add, new_pack;
+       u32 off, size;
+       __le16 size_pack;
+       struct ATTRIB *attr;
+       struct ATTR_LIST_ENTRY *le;
+       struct mft_inode *mi;
+       struct runs_tree ea_run;
+       u64 new_sz;
+       void *p;
+       if (!locked)
+               ni_lock(ni);
+       run_init(&ea_run);
+       if (name_len > 255) {
+               err = -ENAMETOOLONG;
+               goto out;
+       }
+       add = ALIGN(struct_size(ea_all, name, 1 + name_len + val_size), 4);
+       err = ntfs_read_ea(ni, &ea_all, add, &info);
+       if (err)
+               goto out;
+       if (!info) {
+               memset(&ea_info, 0, sizeof(ea_info));
+               size = 0;
+               size_pack = 0;
+       } else {
+               memcpy(&ea_info, info, sizeof(ea_info));
+               size = le32_to_cpu(ea_info.size);
+               size_pack = ea_info.size_pack;
+       }
+       if (info && find_ea(ea_all, size, name, name_len, &off)) {
+               struct EA_FULL *ea;
+               size_t ea_sz;
+               if (flags & XATTR_CREATE) {
+                       err = -EEXIST;
+                       goto out;
+               }
+               ea = Add2Ptr(ea_all, off);
+               /*
+                * Check simple case when we try to insert xattr with the same value
+                * e.g. ntfs_save_wsl_perm
+                */
+               if (val_size && le16_to_cpu(ea->elength) == val_size &&
+                   !memcmp(ea->name + ea->name_len + 1, value, val_size)) {
+                       /* xattr already contains the required value. */
+                       goto out;
+               }
+               /* Remove current xattr. */
+               if (ea->flags & FILE_NEED_EA)
+                       le16_add_cpu(&ea_info.count, -1);
+               ea_sz = unpacked_ea_size(ea);
+               le16_add_cpu(&ea_info.size_pack, 0 - packed_ea_size(ea));
+               memmove(ea, Add2Ptr(ea, ea_sz), size - off - ea_sz);
+               size -= ea_sz;
+               memset(Add2Ptr(ea_all, size), 0, ea_sz);
+               ea_info.size = cpu_to_le32(size);
+               if ((flags & XATTR_REPLACE) && !val_size) {
+                       /* Remove xattr. */
+                       goto update_ea;
+               }
+       } else {
+               if (flags & XATTR_REPLACE) {
+                       err = -ENODATA;
+                       goto out;
+               }
+               if (!ea_all) {
+                       ea_all = kzalloc(add, GFP_NOFS);
+                       if (!ea_all) {
+                               err = -ENOMEM;
+                               goto out;
+                       }
+               }
+       }
+       /* Append new xattr. */
+       new_ea = Add2Ptr(ea_all, size);
+       new_ea->size = cpu_to_le32(add);
+       new_ea->flags = 0;
+       new_ea->name_len = name_len;
+       new_ea->elength = cpu_to_le16(val_size);
+       memcpy(new_ea->name, name, name_len);
+       new_ea->name[name_len] = 0;
+       memcpy(new_ea->name + name_len + 1, value, val_size);
+       new_pack = le16_to_cpu(ea_info.size_pack) + packed_ea_size(new_ea);
+       /* Should fit into 16 bits. */
+       if (new_pack > 0xffff) {
+               err = -EFBIG; // -EINVAL?
+               goto out;
+       }
+       ea_info.size_pack = cpu_to_le16(new_pack);
+       /* New size of ATTR_EA. */
+       size += add;
+       if (size > sbi->ea_max_size) {
+               err = -EFBIG; // -EINVAL?
+               goto out;
+       }
+       ea_info.size = cpu_to_le32(size);
+ update_ea:
+       if (!info) {
+               /* Create xattr. */
+               if (!size) {
+                       err = 0;
+                       goto out;
+               }
+               err = ni_insert_resident(ni, sizeof(struct EA_INFO),
+                                        ATTR_EA_INFO, NULL, 0, NULL, NULL,
+                                        NULL);
+               if (err)
+                       goto out;
+               err = ni_insert_resident(ni, 0, ATTR_EA, NULL, 0, NULL, NULL,
+                                        NULL);
+               if (err)
+                       goto out;
+       }
+       new_sz = size;
+       err = attr_set_size(ni, ATTR_EA, NULL, 0, &ea_run, new_sz, &new_sz,
+                           false, NULL);
+       if (err)
+               goto out;
+       le = NULL;
+       attr = ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, &mi);
+       if (!attr) {
+               err = -EINVAL;
+               goto out;
+       }
+       if (!size) {
+               /* Delete xattr, ATTR_EA_INFO */
+               ni_remove_attr_le(ni, attr, mi, le);
+       } else {
+               p = resident_data_ex(attr, sizeof(struct EA_INFO));
+               if (!p) {
+                       err = -EINVAL;
+                       goto out;
+               }
+               memcpy(p, &ea_info, sizeof(struct EA_INFO));
+               mi->dirty = true;
+       }
+       le = NULL;
+       attr = ni_find_attr(ni, NULL, &le, ATTR_EA, NULL, 0, NULL, &mi);
+       if (!attr) {
+               err = -EINVAL;
+               goto out;
+       }
+       if (!size) {
+               /* Delete xattr, ATTR_EA */
+               ni_remove_attr_le(ni, attr, mi, le);
+       } else if (attr->non_res) {
+               err = ntfs_sb_write_run(sbi, &ea_run, 0, ea_all, size);
+               if (err)
+                       goto out;
+       } else {
+               p = resident_data_ex(attr, size);
+               if (!p) {
+                       err = -EINVAL;
+                       goto out;
+               }
+               memcpy(p, ea_all, size);
+               mi->dirty = true;
+       }
+       /* Check if we delete the last xattr. */
+       if (size)
+               ni->ni_flags |= NI_FLAG_EA;
+       else
+               ni->ni_flags &= ~NI_FLAG_EA;
+       if (ea_info.size_pack != size_pack)
+               ni->ni_flags |= NI_FLAG_UPDATE_PARENT;
+       mark_inode_dirty(&ni->vfs_inode);
+ out:
+       if (!locked)
+               ni_unlock(ni);
+       run_close(&ea_run);
+       kfree(ea_all);
+       return err;
+ }
+ #ifdef CONFIG_NTFS3_FS_POSIX_ACL
+ static inline void ntfs_posix_acl_release(struct posix_acl *acl)
+ {
+       if (acl && refcount_dec_and_test(&acl->a_refcount))
+               kfree(acl);
+ }
+ static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
+                                        struct inode *inode, int type,
+                                        int locked)
+ {
+       struct ntfs_inode *ni = ntfs_i(inode);
+       const char *name;
+       size_t name_len;
+       struct posix_acl *acl;
+       size_t req;
+       int err;
+       void *buf;
+       /* Allocate PATH_MAX bytes. */
+       buf = __getname();
+       if (!buf)
+               return ERR_PTR(-ENOMEM);
+       /* Possible values of 'type' was already checked above. */
+       if (type == ACL_TYPE_ACCESS) {
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
+               name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
+       } else {
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
+               name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
+       }
+       if (!locked)
+               ni_lock(ni);
+       err = ntfs_get_ea(inode, name, name_len, buf, PATH_MAX, &req);
+       if (!locked)
+               ni_unlock(ni);
+       /* Translate extended attribute to acl. */
+       if (err >= 0) {
+               acl = posix_acl_from_xattr(mnt_userns, buf, err);
+               if (!IS_ERR(acl))
+                       set_cached_acl(inode, type, acl);
+       } else {
+               acl = err == -ENODATA ? NULL : ERR_PTR(err);
+       }
+       __putname(buf);
+       return acl;
+ }
+ /*
+  * ntfs_get_acl - inode_operations::get_acl
+  */
 -      acl = ntfs_get_acl(inode, type);
++struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu)
+ {
++      if (rcu)
++              return ERR_PTR(-ECHILD);
++
+       /* TODO: init_user_ns? */
+       return ntfs_get_acl_ex(&init_user_ns, inode, type, 0);
+ }
+ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
+                                   struct inode *inode, struct posix_acl *acl,
+                                   int type, int locked)
+ {
+       const char *name;
+       size_t size, name_len;
+       void *value = NULL;
+       int err = 0;
+       if (S_ISLNK(inode->i_mode))
+               return -EOPNOTSUPP;
+       switch (type) {
+       case ACL_TYPE_ACCESS:
+               if (acl) {
+                       umode_t mode = inode->i_mode;
+                       err = posix_acl_equiv_mode(acl, &mode);
+                       if (err < 0)
+                               return err;
+                       if (inode->i_mode != mode) {
+                               inode->i_mode = mode;
+                               mark_inode_dirty(inode);
+                       }
+                       if (!err) {
+                               /*
+                                * ACL can be exactly represented in the
+                                * traditional file mode permission bits.
+                                */
+                               acl = NULL;
+                       }
+               }
+               name = XATTR_NAME_POSIX_ACL_ACCESS;
+               name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
+               break;
+       case ACL_TYPE_DEFAULT:
+               if (!S_ISDIR(inode->i_mode))
+                       return acl ? -EACCES : 0;
+               name = XATTR_NAME_POSIX_ACL_DEFAULT;
+               name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
+               break;
+       default:
+               return -EINVAL;
+       }
+       if (!acl) {
+               size = 0;
+               value = NULL;
+       } else {
+               size = posix_acl_xattr_size(acl->a_count);
+               value = kmalloc(size, GFP_NOFS);
+               if (!value)
+                       return -ENOMEM;
+               err = posix_acl_to_xattr(mnt_userns, acl, value, size);
+               if (err < 0)
+                       goto out;
+       }
+       err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked);
+       if (!err)
+               set_cached_acl(inode, type, acl);
+ out:
+       kfree(value);
+       return err;
+ }
+ /*
+  * ntfs_set_acl - inode_operations::set_acl
+  */
+ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+                struct posix_acl *acl, int type)
+ {
+       return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
+ }
+ static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
+                             struct inode *inode, int type, void *buffer,
+                             size_t size)
+ {
+       struct posix_acl *acl;
+       int err;
+       if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
+               ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
+               return -EOPNOTSUPP;
+       }
++      acl = ntfs_get_acl(inode, type, false);
+       if (IS_ERR(acl))
+               return PTR_ERR(acl);
+       if (!acl)
+               return -ENODATA;
+       err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
+       ntfs_posix_acl_release(acl);
+       return err;
+ }
+ static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
+                             struct inode *inode, int type, const void *value,
+                             size_t size)
+ {
+       struct posix_acl *acl;
+       int err;
+       if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
+               ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
+               return -EOPNOTSUPP;
+       }
+       if (!inode_owner_or_capable(mnt_userns, inode))
+               return -EPERM;
+       if (!value) {
+               acl = NULL;
+       } else {
+               acl = posix_acl_from_xattr(mnt_userns, value, size);
+               if (IS_ERR(acl))
+                       return PTR_ERR(acl);
+               if (acl) {
+                       err = posix_acl_valid(mnt_userns, acl);
+                       if (err)
+                               goto release_and_out;
+               }
+       }
+       err = ntfs_set_acl(mnt_userns, inode, acl, type);
+ release_and_out:
+       ntfs_posix_acl_release(acl);
+       return err;
+ }
+ /*
+  * ntfs_init_acl - Initialize the ACLs of a new inode.
+  *
+  * Called from ntfs_create_inode().
+  */
+ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
+                 struct inode *dir)
+ {
+       struct posix_acl *default_acl, *acl;
+       int err;
+       /*
+        * TODO: Refactoring lock.
+        * ni_lock(dir) ... -> posix_acl_create(dir,...) -> ntfs_get_acl -> ni_lock(dir)
+        */
+       inode->i_default_acl = NULL;
+       default_acl = ntfs_get_acl_ex(mnt_userns, dir, ACL_TYPE_DEFAULT, 1);
+       if (!default_acl || default_acl == ERR_PTR(-EOPNOTSUPP)) {
+               inode->i_mode &= ~current_umask();
+               err = 0;
+               goto out;
+       }
+       if (IS_ERR(default_acl)) {
+               err = PTR_ERR(default_acl);
+               goto out;
+       }
+       acl = default_acl;
+       err = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
+       if (err < 0)
+               goto out1;
+       if (!err) {
+               posix_acl_release(acl);
+               acl = NULL;
+       }
+       if (!S_ISDIR(inode->i_mode)) {
+               posix_acl_release(default_acl);
+               default_acl = NULL;
+       }
+       if (default_acl)
+               err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
+                                     ACL_TYPE_DEFAULT, 1);
+       if (!acl)
+               inode->i_acl = NULL;
+       else if (!err)
+               err = ntfs_set_acl_ex(mnt_userns, inode, acl, ACL_TYPE_ACCESS,
+                                     1);
+       posix_acl_release(acl);
+ out1:
+       posix_acl_release(default_acl);
+ out:
+       return err;
+ }
+ #endif
+ /*
+  * ntfs_acl_chmod - Helper for ntfs3_setattr().
+  */
+ int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
+ {
+       struct super_block *sb = inode->i_sb;
+       if (!(sb->s_flags & SB_POSIXACL))
+               return 0;
+       if (S_ISLNK(inode->i_mode))
+               return -EOPNOTSUPP;
+       return posix_acl_chmod(mnt_userns, inode, inode->i_mode);
+ }
+ /*
+  * ntfs_permission - inode_operations::permission
+  */
+ int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
+                   int mask)
+ {
+       if (ntfs_sb(inode->i_sb)->options.no_acs_rules) {
+               /* "No access rules" mode - Allow all changes. */
+               return 0;
+       }
+       return generic_permission(mnt_userns, inode, mask);
+ }
+ /*
+  * ntfs_listxattr - inode_operations::listxattr
+  */
+ ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
+ {
+       struct inode *inode = d_inode(dentry);
+       struct ntfs_inode *ni = ntfs_i(inode);
+       ssize_t ret;
+       if (!(ni->ni_flags & NI_FLAG_EA)) {
+               /* no xattr in file */
+               return 0;
+       }
+       ni_lock(ni);
+       ret = ntfs_list_ea(ni, buffer, size);
+       ni_unlock(ni);
+       return ret;
+ }
+ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
+                        struct inode *inode, const char *name, void *buffer,
+                        size_t size)
+ {
+       int err;
+       struct ntfs_inode *ni = ntfs_i(inode);
+       size_t name_len = strlen(name);
+       /* Dispatch request. */
+       if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
+           !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
+               /* system.dos_attrib */
+               if (!buffer) {
+                       err = sizeof(u8);
+               } else if (size < sizeof(u8)) {
+                       err = -ENODATA;
+               } else {
+                       err = sizeof(u8);
+                       *(u8 *)buffer = le32_to_cpu(ni->std_fa);
+               }
+               goto out;
+       }
+       if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
+           !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
+               /* system.ntfs_attrib */
+               if (!buffer) {
+                       err = sizeof(u32);
+               } else if (size < sizeof(u32)) {
+                       err = -ENODATA;
+               } else {
+                       err = sizeof(u32);
+                       *(u32 *)buffer = le32_to_cpu(ni->std_fa);
+               }
+               goto out;
+       }
+       if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
+           !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
+               /* system.ntfs_security*/
+               struct SECURITY_DESCRIPTOR_RELATIVE *sd = NULL;
+               size_t sd_size = 0;
+               if (!is_ntfs3(ni->mi.sbi)) {
+                       /* We should get nt4 security. */
+                       err = -EINVAL;
+                       goto out;
+               } else if (le32_to_cpu(ni->std_security_id) <
+                          SECURITY_ID_FIRST) {
+                       err = -ENOENT;
+                       goto out;
+               }
+               err = ntfs_get_security_by_id(ni->mi.sbi, ni->std_security_id,
+                                             &sd, &sd_size);
+               if (err)
+                       goto out;
+               if (!is_sd_valid(sd, sd_size)) {
+                       ntfs_inode_warn(
+                               inode,
+                               "looks like you get incorrect security descriptor id=%u",
+                               ni->std_security_id);
+               }
+               if (!buffer) {
+                       err = sd_size;
+               } else if (size < sd_size) {
+                       err = -ENODATA;
+               } else {
+                       err = sd_size;
+                       memcpy(buffer, sd, sd_size);
+               }
+               kfree(sd);
+               goto out;
+       }
+ #ifdef CONFIG_NTFS3_FS_POSIX_ACL
+       if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
+            !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
+                    sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
+           (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
+            !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
+                    sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
+               /* TODO: init_user_ns? */
+               err = ntfs_xattr_get_acl(
+                       &init_user_ns, inode,
+                       name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
+                               ? ACL_TYPE_ACCESS
+                               : ACL_TYPE_DEFAULT,
+                       buffer, size);
+               goto out;
+       }
+ #endif
+       /* Deal with NTFS extended attribute. */
+       err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
+ out:
+       return err;
+ }
+ /*
+  * ntfs_setxattr - inode_operations::setxattr
+  */
+ static noinline int ntfs_setxattr(const struct xattr_handler *handler,
+                                 struct user_namespace *mnt_userns,
+                                 struct dentry *de, struct inode *inode,
+                                 const char *name, const void *value,
+                                 size_t size, int flags)
+ {
+       int err = -EINVAL;
+       struct ntfs_inode *ni = ntfs_i(inode);
+       size_t name_len = strlen(name);
+       enum FILE_ATTRIBUTE new_fa;
+       /* Dispatch request. */
+       if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
+           !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
+               if (sizeof(u8) != size)
+                       goto out;
+               new_fa = cpu_to_le32(*(u8 *)value);
+               goto set_new_fa;
+       }
+       if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
+           !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
+               if (size != sizeof(u32))
+                       goto out;
+               new_fa = cpu_to_le32(*(u32 *)value);
+               if (S_ISREG(inode->i_mode)) {
+                       /* Process compressed/sparsed in special way. */
+                       ni_lock(ni);
+                       err = ni_new_attr_flags(ni, new_fa);
+                       ni_unlock(ni);
+                       if (err)
+                               goto out;
+               }
+ set_new_fa:
+               /*
+                * Thanks Mark Harmstone:
+                * Keep directory bit consistency.
+                */
+               if (S_ISDIR(inode->i_mode))
+                       new_fa |= FILE_ATTRIBUTE_DIRECTORY;
+               else
+                       new_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
+               if (ni->std_fa != new_fa) {
+                       ni->std_fa = new_fa;
+                       if (new_fa & FILE_ATTRIBUTE_READONLY)
+                               inode->i_mode &= ~0222;
+                       else
+                               inode->i_mode |= 0222;
+                       /* Std attribute always in primary record. */
+                       ni->mi.dirty = true;
+                       mark_inode_dirty(inode);
+               }
+               err = 0;
+               goto out;
+       }
+       if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
+           !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
+               /* system.ntfs_security*/
+               __le32 security_id;
+               bool inserted;
+               struct ATTR_STD_INFO5 *std;
+               if (!is_ntfs3(ni->mi.sbi)) {
+                       /*
+                        * We should replace ATTR_SECURE.
+                        * Skip this way cause it is nt4 feature.
+                        */
+                       err = -EINVAL;
+                       goto out;
+               }
+               if (!is_sd_valid(value, size)) {
+                       err = -EINVAL;
+                       ntfs_inode_warn(
+                               inode,
+                               "you try to set invalid security descriptor");
+                       goto out;
+               }
+               err = ntfs_insert_security(ni->mi.sbi, value, size,
+                                          &security_id, &inserted);
+               if (err)
+                       goto out;
+               ni_lock(ni);
+               std = ni_std5(ni);
+               if (!std) {
+                       err = -EINVAL;
+               } else if (std->security_id != security_id) {
+                       std->security_id = ni->std_security_id = security_id;
+                       /* Std attribute always in primary record. */
+                       ni->mi.dirty = true;
+                       mark_inode_dirty(&ni->vfs_inode);
+               }
+               ni_unlock(ni);
+               goto out;
+       }
+ #ifdef CONFIG_NTFS3_FS_POSIX_ACL
+       if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
+            !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
+                    sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
+           (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
+            !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
+                    sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
+               err = ntfs_xattr_set_acl(
+                       mnt_userns, inode,
+                       name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
+                               ? ACL_TYPE_ACCESS
+                               : ACL_TYPE_DEFAULT,
+                       value, size);
+               goto out;
+       }
+ #endif
+       /* Deal with NTFS extended attribute. */
+       err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
+ out:
+       return err;
+ }
+ /*
+  * ntfs_save_wsl_perm
+  *
+  * save uid/gid/mode in xattr
+  */
+ int ntfs_save_wsl_perm(struct inode *inode)
+ {
+       int err;
+       __le32 value;
+       value = cpu_to_le32(i_uid_read(inode));
+       err = ntfs_set_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value,
+                         sizeof(value), 0, 0);
+       if (err)
+               goto out;
+       value = cpu_to_le32(i_gid_read(inode));
+       err = ntfs_set_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value,
+                         sizeof(value), 0, 0);
+       if (err)
+               goto out;
+       value = cpu_to_le32(inode->i_mode);
+       err = ntfs_set_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value,
+                         sizeof(value), 0, 0);
+       if (err)
+               goto out;
+       if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
+               value = cpu_to_le32(inode->i_rdev);
+               err = ntfs_set_ea(inode, "$LXDEV", sizeof("$LXDEV") - 1, &value,
+                                 sizeof(value), 0, 0);
+               if (err)
+                       goto out;
+       }
+ out:
+       /* In case of error should we delete all WSL xattr? */
+       return err;
+ }
+ /*
+  * ntfs_get_wsl_perm
+  *
+  * get uid/gid/mode from xattr
+  * it is called from ntfs_iget5->ntfs_read_mft
+  */
+ void ntfs_get_wsl_perm(struct inode *inode)
+ {
+       size_t sz;
+       __le32 value[3];
+       if (ntfs_get_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value[0],
+                       sizeof(value[0]), &sz) == sizeof(value[0]) &&
+           ntfs_get_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value[1],
+                       sizeof(value[1]), &sz) == sizeof(value[1]) &&
+           ntfs_get_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value[2],
+                       sizeof(value[2]), &sz) == sizeof(value[2])) {
+               i_uid_write(inode, (uid_t)le32_to_cpu(value[0]));
+               i_gid_write(inode, (gid_t)le32_to_cpu(value[1]));
+               inode->i_mode = le32_to_cpu(value[2]);
+               if (ntfs_get_ea(inode, "$LXDEV", sizeof("$$LXDEV") - 1,
+                               &value[0], sizeof(value),
+                               &sz) == sizeof(value[0])) {
+                       inode->i_rdev = le32_to_cpu(value[0]);
+               }
+       }
+ }
+ static bool ntfs_xattr_user_list(struct dentry *dentry)
+ {
+       return true;
+ }
+ // clang-format off
+ static const struct xattr_handler ntfs_xattr_handler = {
+       .prefix = "",
+       .get    = ntfs_getxattr,
+       .set    = ntfs_setxattr,
+       .list   = ntfs_xattr_user_list,
+ };
+ const struct xattr_handler *ntfs_xattr_handlers[] = {
+       &ntfs_xattr_handler,
+       NULL,
+ };
+ // clang-format on