Skip to content

Commit

Permalink
fs: exfat: Update exFAT driver
Browse files Browse the repository at this point in the history
git-repository: https://github.com/namjaejeon/linux-exfat-oot.git
Date: Aug 8, 2024
Last commit: exfat: do not fallback to buffered write

Note:
Your device didn't come with exFat, you can't add extra official support, you can't include something that doesn't have it in stock, that's for Lineage (their device requirements) only.

SDFat is old, so let's move on to something more up-to-date and with better performance.

Signed-off-by: TogoFire <togofire@mailfence.com>
Change-Id: 40cf112
  • Loading branch information
TogoFire committed Sep 25, 2024
1 parent a3ae2e1 commit 856b250
Show file tree
Hide file tree
Showing 13 changed files with 748 additions and 1,256 deletions.
29 changes: 13 additions & 16 deletions fs/exfat/.github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ name: linux-exfat-oot CI

on:
push:
branches: [ "for-kernel-version-from-4.1.0" ]
branches: [ "master" ]
pull_request:
branches: [ "for-kernel-version-from-4.1.0" ]
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download the kernel
run: |
sudo apt-get update
sudo apt-get install libelf-dev wget tar gzip python2.7
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.1.36.tar.gz
tar xf linux-4.1.36.tar.gz
mv linux-4.1.36 linux-stable
rm -rf linux-4.1.36.tar.gz
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.15.140.tar.gz
tar xf linux-5.15.140.tar.gz
mv linux-5.15.140 linux-stable
rm -rf linux-5.15.140.tar.gz
- name: Prerequisite for xfstests testing
run: |
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install autoconf libtool pkg-config libnl-3-dev libnl-genl-3-dev
sudo apt-get install autoconf libtool pkg-config
sudo apt-get install xfslibs-dev uuid-dev libtool-bin xfsprogs libgdbm-dev gawk fio attr libattr1-dev libacl1-dev libaio-dev
git clone --branch=exfat-next https://github.com/exfat-utils/exfat-utils
git clone --branch=exfat-next https://github.com/exfatprogs/exfatprogs
git clone https://github.com/namjaejeon/exfat-testsuites
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/lib:$PATH
Expand All @@ -35,17 +35,14 @@ jobs:
- name: Copy exfat source to kernel
run: |
mv linux-stable ../
mkdir ../linux-stable/fs/exfat
cp -ar * ../linux-stable/fs/exfat/
- name: Compile with 4.1 kernel
- name: Compile with 5.15 kernel
run: |
cd ../linux-stable
yes "" | make oldconfig > /dev/null
echo 'obj-$(CONFIG_EXFAT_FS) += exfat/' >> fs/Makefile
echo 'source "fs/exfat/Kconfig"' >> fs/Kconfig
echo 'CONFIG_EXFAT_FS=m' >> .config
echo 'CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"' >> .config
make -j$((`nproc`+1)) fs/exfat/exfat.ko
make KBUILD_MODPOST_WARN=1 KBUILD_MODPOST_NOFINAL=1 fs/exfat/exfat.ko
- name: Run xfstests testsuite
run: |
cd ..
Expand All @@ -54,7 +51,7 @@ jobs:
make > /dev/null
sudo make install > /dev/null
sudo insmod exfat.ko
cd exfat-utils
cd exfatprogs
./autogen.sh > /dev/null
./configure > /dev/null
make -j$((`nproc`+1)) > /dev/null
Expand Down Expand Up @@ -87,6 +84,7 @@ jobs:
run: |
cd exfat-testsuites/
tar xzvf xfstests-exfat.tgz > /dev/null
rm -f xfstests-exfat.tgz
cd xfstests-exfat
make -j$((`nproc`+1)) > /dev/null
truncate -s 100G test.img
Expand Down Expand Up @@ -126,7 +124,6 @@ jobs:
sudo ./check generic/124
sudo ./check generic/127
sudo ./check generic/129
sudo ./check generic/130
sudo ./check generic/131
sudo ./check generic/132
sudo ./check generic/133
Expand Down
5 changes: 3 additions & 2 deletions fs/exfat/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## exFAT filesystem
This is the exfat filesystem for support from the linux 4.1 kernel
to the latest kernel.
This is the exfat filesystem for support from the linux 5.15 kernel
to the latest kernel. If you want to use exfat from 4.1 ~ 5.15 kernel,
Please use #for-kernel-version-from-4.1.0 branch.

## Installing as a stand-alone module

Expand Down
12 changes: 0 additions & 12 deletions fs/exfat/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
#include <linux/slab.h>
#include <linux/bitmap.h>
#include <linux/buffer_head.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#else
#include <linux/sched.h>
#endif
#include <linux/vmalloc.h>

#include "exfat_raw.h"
Expand All @@ -30,10 +26,6 @@
#error "BITS_PER_LONG not 32 or 64"
#endif

#ifndef ALIGN_DOWN
#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
#endif

/*
* Allocation Bitmap Management Functions
*/
Expand Down Expand Up @@ -61,12 +53,8 @@ static int exfat_allocate_bitmap(struct super_block *sb,
}
sbi->map_sectors = ((need_map_size - 1) >>
(sb->s_blocksize_bits)) + 1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
sbi->vol_amap = kvmalloc_array(sbi->map_sectors,
sizeof(struct buffer_head *), GFP_KERNEL);
#else
sbi->vol_amap = vmalloc(sbi->map_sectors * sizeof(struct buffer_head *));
#endif
if (!sbi->vol_amap)
return -ENOMEM;

Expand Down
4 changes: 4 additions & 0 deletions fs/exfat/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ int exfat_cache_init(void)
{
exfat_cachep = kmem_cache_create("exfat_cache",
sizeof(struct exfat_cache),
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)
0, SLAB_RECLAIM_ACCOUNT,
#else
0, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD,
#endif
exfat_cache_init_once);
if (!exfat_cachep)
return -ENOMEM;
Expand Down
Loading

0 comments on commit 856b250

Please sign in to comment.