Browse Source

Merge pull request #495 from ahippo/external-fuse

Option for building with system libfuse
pull/496/head
trapexit 6 years ago
committed by GitHub
parent
commit
a894360402
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      Makefile
  2. 17
      README.md
  3. 3
      libfuse/lib/fuse.c
  4. 23
      man/mergerfs.1
  5. 3
      src/option_parser.cpp

30
Makefile

@ -28,6 +28,7 @@ SED = $(shell which sed)
GZIP = $(shell which gzip)
RPMBUILD = $(shell which rpmbuild)
GIT2DEBCL = ./tools/git2debcl
PKGCONFIG = pkg-config
GIT_REPO = 0
ifneq ($(GIT),)
@ -42,6 +43,22 @@ endif
XATTR_AVAILABLE = $(shell test ! -e /usr/include/attr/xattr.h; echo $$?)
INTERNAL_FUSE = 1
EXTERNAL_FUSE_MIN_REQ = 2.9.7
ifeq ($(INTERNAL_FUSE),1)
FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -Ilibfuse/include
FUSE_LIBS = libfuse/lib/.libs/libfuse.a
FUSE_TARGET = $(FUSE_LIBS)
else
FUSE_CFLAGS := $(shell $(PKGCONFIG) --cflags 'fuse >= $(EXTERNAL_FUSE_MIN_REQ)')
FUSE_LIBS := $(shell $(PKGCONFIG) --libs 'fuse >= $(EXTERNAL_FUSE_MIN_REQ)')
FUSE_TARGET :=
ifeq ($(FUSE_CFLAGS)$(FUSE_LIBS),)
$(error "Use of external FUSE requested, but no libfuse >= $(EXTERNAL_FUSE_MIN_REQ) found.")
endif
endif
UGID_USE_RWLOCK = 0
OPTS = -O2
@ -50,7 +67,6 @@ OBJ = $(SRC:src/%.cpp=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d)
TARGET = mergerfs
MANPAGE = $(TARGET).1
FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -Ilibfuse/include
CFLAGS = -g -Wall \
$(OPTS) \
-Wno-unused-result \
@ -82,10 +98,10 @@ all: $(TARGET)
help:
@echo "usage: make"
@echo "make XATTR_AVAILABLE=0 - to build program without xattrs functionality (auto discovered otherwise)"
@echo "make INTERNAL_FUSE=0 - to build program with external (system) libfuse rather than the bundled one ('-o threads=' option will be unavailable)"
$(TARGET): version obj/obj-stamp libfuse/lib/.libs/libfuse.a $(OBJ)
cd libfuse && make
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@ libfuse/lib/.libs/libfuse.a -ldl -pthread -lrt
$(TARGET): version obj/obj-stamp $(FUSE_TARGET) $(OBJ)
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@ $(FUSE_LIBS) -ldl -pthread -lrt
mount.mergerfs: $(TARGET)
$(LN) -fs "$<" "$@"
@ -115,10 +131,14 @@ clean: rpm-clean libfuse_Makefile
$(RM) -rf obj
$(RM) -f "$(TARGET)" mount.mergerfs
$(FIND) . -name "*~" -delete
ifeq ($(INTERNAL_FUSE),1)
cd libfuse && $(MAKE) clean
endif
distclean: clean libfuse_Makefile
ifeq ($(INTERNAL_FUSE),1)
cd libfuse && $(MAKE) distclean
endif
ifeq ($(GIT_REPO),1)
$(GIT) clean -fd
endif
@ -210,12 +230,14 @@ endif
unexport CFLAGS
.PHONY: libfuse_Makefile
libfuse_Makefile:
ifeq ($(INTERNAL_FUSE),1)
ifeq ($(shell test -e libfuse/Makefile; echo $$?),1)
cd libfuse && \
$(MKDIR) -p m4 && \
autoreconf --force --install && \
./configure --enable-lib --disable-util --disable-example
endif
endif
libfuse/lib/.libs/libfuse.a: libfuse_Makefile
cd libfuse && $(MAKE)

17
README.md

@ -71,7 +71,7 @@ mergerfs does **not** support the copy-on-write (CoW) behavior found in **aufs**
* **symlinkify_timeout=value**: time to wait, in seconds, to activate the **symlinkify** behavior. (default: 3600)
* **nullrw=true|false**: turns reads and writes into no-ops. The request will succeed but do nothing. Useful for benchmarking mergerfs. (default: false)
* **ignorepponrename=true|false**: ignore path preserving on rename. Typically rename and link act differently depending on the policy of `create` (read below). Enabling this will cause rename and link to always use the non-path preserving behavior. This means files, when renamed or linked, will stay on the same drive. (default: false)
* **threads=num**: number of threads to use in multithreaded mode. When set to zero (the default) it will attempt to discover and use the number of logical cores. If the lookup fails it will fall back to using 4. If the thread count is set negative it will look up the number of cores then divide by the absolute value. ie. threads=-2 on an 8 core machine will result in 8 / 2 = 4 threads. There will always be at least 1 thread. NOTE: higher number of threads increases parallelism but usually decreases throughput. (default: number of cores)
* **threads=num**: number of threads to use in multithreaded mode. When set to zero (the default) it will attempt to discover and use the number of logical cores. If the lookup fails it will fall back to using 4. If the thread count is set negative it will look up the number of cores then divide by the absolute value. ie. threads=-2 on an 8 core machine will result in 8 / 2 = 4 threads. There will always be at least 1 thread. NOTE: higher number of threads increases parallelism but usually decreases throughput. (default: number of cores) *NOTE2:* the option is unavailable when built with system libfuse.
* **fsname=name**: sets the name of the filesystem as seen in **mount**, **df**, etc. Defaults to a list of the source paths concatenated together with the longest common prefix removed.
* **func.&lt;func&gt;=&lt;policy&gt;**: sets the specific FUSE function's policy. See below for the list of value types. Example: **func.getattr=newest**
* **category.&lt;category&gt;=&lt;policy&gt;**: Sets policy of all FUSE functions in the provided category. Example: **category.create=mfs**
@ -287,6 +287,19 @@ $ make
$ sudo make install
```
#### Generically with system libfuse
**NOTE:** Multithreading and thus `-o threads=num` option will be unavailable when built with system libfuse.
Have git, g++, make, python, libattr1, pkg-config installed.
Also, install libfuse >= 2.9.7 (but not libfuse-3.x) and matching libfuse-dev (or libfuse-devel).
```
$ cd mergerfs
$ make INTERNAL_FUSE=0
$ sudo make INTERNAL_FUSE=0 install
```
# RUNTIME
#### .mergerfs pseudo file ####
@ -550,7 +563,7 @@ The gid cache uses fixed storage to simplify the design and be compatible with o
#### mergerfs or libfuse crashing
**NOTE:** as of mergerfs 2.22.0 it includes the most recent version of libfuse so any crash should be reported. For older releases continue reading...
**NOTE:** as of mergerfs 2.22.0 it includes the most recent version of libfuse (or requires libfuse-2.9.7) so any crash should be reported. For older releases continue reading...
If suddenly the mergerfs mount point disappears and `Transport endpoint is not connected` is returned when attempting to perform actions within the mount directory **and** the version of libfuse (use `mergerfs -v` to find the version) is older than `2.9.4` its likely due to a bug in libfuse. Affected versions of libfuse can be found in Debian Wheezy, Ubuntu Precise and others.

3
libfuse/lib/fuse.c

@ -4432,6 +4432,9 @@ static void fuse_lib_help(void)
" -o intr allow requests to be interrupted\n"
" -o intr_signal=NUM signal to send on interrupt (%i)\n"
" -o modules=M1[:M2...] names of modules to push onto filesystem stack\n"
" -o threads=NUM number of worker threads. 0 = autodetect.\n"
" Negative values autodetect then divide by\n"
" absolute value. default = 0\n"
"\n", FUSE_DEFAULT_INTR_SIGNAL);
}

23
man/mergerfs.1

@ -1,5 +1,5 @@
.\"t
.\" Automatically generated by Pandoc 1.19.2.4
.\" Automatically generated by Pandoc 1.19.2.1
.\"
.TH "mergerfs" "1" "2018\-07\-25" "mergerfs user manual" ""
.hy
@ -163,7 +163,8 @@ threads=\-2 on an 8 core machine will result in 8 / 2 = 4 threads.
There will always be at least 1 thread.
NOTE: higher number of threads increases parallelism but usually
decreases throughput.
(default: number of cores)
(default: number of cores) \f[I]NOTE2:\f[] the option is unavailable
when built with system libfuse.
.IP \[bu] 2
\f[B]fsname=name\f[]: sets the name of the filesystem as seen in
\f[B]mount\f[], \f[B]df\f[], etc.
@ -699,6 +700,22 @@ $\ make
$\ sudo\ make\ install
\f[]
.fi
.SS Generically with system libfuse
.PP
\f[B]NOTE:\f[] Multithreading and thus \f[C]\-o\ threads=num\f[] option
will be unavailable when built with system libfuse.
.PP
Have git, g++, make, python, libattr1, pkg\-config installed.
Also, install libfuse >= 2.9.7 (but not libfuse\-3.x) and matching
libfuse\-dev (or libfuse\-devel).
.IP
.nf
\f[C]
$\ cd\ mergerfs
$\ make\ INTERNAL_FUSE=0
$\ sudo\ make\ INTERNAL_FUSE=0\ install
\f[]
.fi
.SH RUNTIME
.SS .mergerfs pseudo file
.IP
@ -1216,7 +1233,7 @@ Note that doing so will increase the memory needed by each thread.
.SS mergerfs or libfuse crashing
.PP
\f[B]NOTE:\f[] as of mergerfs 2.22.0 it includes the most recent version
of libfuse so any crash should be reported.
of libfuse (or requires libfuse\-2.9.7) so any crash should be reported.
For older releases continue reading...
.PP
If suddenly the mergerfs mount point disappears and

3
src/option_parser.cpp

@ -299,9 +299,6 @@ usage(void)
" -o ignorepponrename=<bool>\n"
" Ignore path preserving when performing renames\n"
" and links. default = false\n"
" -o threads=<int> number of worker threads. 0 = autodetect.\n"
" Negative values autodetect then divide by\n"
" absolute value. default = 0\n"
<< std::endl;
}

Loading…
Cancel
Save