I have a fuse-based file system, in order to improve it I need to implement this approach https://lwn.net/Articles/674286/
I understand that i should git apply < patch >
, the problem is that i don't understand exactly where this patch should be applied?
the patch is trying to modify several files such as:
a/fs/fuse/Makefile
a/fs/fuse/dev.c
b/fs/fuse/dev.c
a/fs/fuse/dir.c
b/fs/fuse/dir.c
etc..
which I couldn't find with locate
command, also tried losing the 'a' and 'b' prefix and found just the makefile.
That is a patch to the Linux kernel. You would need to start with a clone of the Linux kernel sources if you don't already have one:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Then you'll need to download the patch. DO NOT attempt to copy-and-paste it from your web browser. You can download kernel patches from https://patchwork.kernel.org/; the patch you referenced appears to be https://patchwork.kernel.org/patch/8182901. Download the mbox
version of the patch from here, which will save it to a file named
v5-fuse-Add-support-for-passthrough-read-write.patch
. You can then apply this patch by running the git am
command from within the linux source directory:
$ cd linux
$ git am /path/to/v5-fuse-Add-support-for-passthrough-read-write.patch
But looking at the patch, it's from Feb 2016, so it's probably not going to apply cleanly against the current version of the kernel. And by "probably", I mean "it doesn't apply"; the above command results in:
Applying: fuse: Add support for passthrough read/write
error: patch failed: fs/fuse/Makefile:5
error: fs/fuse/Makefile: patch does not apply
error: patch failed: fs/fuse/file.c:252
error: fs/fuse/file.c: patch does not apply
error: patch failed: fs/fuse/fuse_i.h:531
error: fs/fuse/fuse_i.h: patch does not apply
error: fs/fuse/fuse_passthrough.h: already exists in working directory
error: patch failed: fs/fuse/inode.c:898
error: fs/fuse/inode.c: patch does not apply
error: fs/fuse/passthrough.c: already exists in working directory
error: patch failed: include/uapi/linux/fuse.h:250
error: include/uapi/linux/fuse.h: patch does not apply
Patch failed at 0001 fuse: Add support for passthrough read/write
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
So what we need to do is roll the kernel sources back to what they looked like back in 2016. First, we need to abort the in-progress git am
operation:
$ git am --abort
And then roll back the sources to on or around Feb 1, 2016:
$ git checkout $(git rev-list -1 --before=2016-02-02 --first-parent master)
Now the patch applies cleanly:
$ git am /path/to/v5-fuse-Add-support-for-passthrough-read-write.patch
Applying: fuse: Add support for passthrough read/write
With the patch applied, you would need to compile and install a new kernel and modules, which is beyond the scope of this answer but which is fairly well documented.
The question to ask yourself is, given that this patch is over a year old and was never accepted into the kernel, are you certain that you need it? Have there been other changes since then that might offer a similar improvement?