mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-21 14:47:57 +08:00
add EDQUOT to errors which trigger moveonenospc
This commit is contained in:
parent
abc4ed4d9f
commit
3fb7f8919a
@ -34,7 +34,7 @@ mergerfs -o<options> <srcmounts> <mountpoint>
|
||||
* **defaults**: a shortcut for FUSE's **atomic_o_trunc**, **auto_cache**, **big_writes**, **default_permissions**, **splice_move**, **splice_read**, and **splice_write**. These options seem to provide the best performance.
|
||||
* **direct_io**: causes FUSE to bypass an addition caching step which can increase write speeds at the detriment of read speed.
|
||||
* **minfreespace**: the minimum space value used for creation policies. Understands 'K', 'M', and 'G' to represent kilobyte, megabyte, and gigabyte respectively. (default: 4G)
|
||||
* **moveonenospc**: when enabled (set to **true**) if a **write** fails with **ENOSPC** a scan of all drives will be done looking for the drive with most free space which is at least the size of the file plus the amount which failed to write. An attempt to move the file to that drive will occur (keeping all metadata possible) and if successful the original is unlinked and the write retried. (default: false)
|
||||
* **moveonenospc**: when enabled (set to **true**) if a **write** fails with **ENOSPC** or **EDQUOT** a scan of all drives will be done looking for the drive with most free space which is at least the size of the file plus the amount which failed to write. An attempt to move the file to that drive will occur (keeping all metadata possible) and if successful the original is unlinked and the write retried. (default: false)
|
||||
* **func.<func>=<policy>**: sets the specific FUSE function's policy. See below for the list of value types. Example: **func.getattr=newest**
|
||||
* **category.<category>=<policy>**: Sets policy of all FUSE functions in the provided category. Example: **category.create=mfs**
|
||||
* **fsname**: 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.
|
||||
|
@ -52,9 +52,9 @@ kilobyte, megabyte, and gigabyte respectively.
|
||||
(default: 4G)
|
||||
.IP \[bu] 2
|
||||
\f[B]moveonenospc\f[]: when enabled (set to \f[B]true\f[]) if a
|
||||
\f[B]write\f[] fails with \f[B]ENOSPC\f[] a scan of all drives will be
|
||||
done looking for the drive with most free space which is at least the
|
||||
size of the file plus the amount which failed to write.
|
||||
\f[B]write\f[] fails with \f[B]ENOSPC\f[] or \f[B]EDQUOT\f[] a scan of
|
||||
all drives will be done looking for the drive with most free space which
|
||||
is at least the size of the file plus the amount which failed to write.
|
||||
An attempt to move the file to that drive will occur (keeping all
|
||||
metadata possible) and if successful the original is unlinked and the
|
||||
write retried.
|
||||
|
@ -25,6 +25,14 @@
|
||||
#include "rwlock.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
static
|
||||
bool
|
||||
_out_of_space(const int error)
|
||||
{
|
||||
return ((error == ENOSPC) ||
|
||||
(error == EDQUOT));
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_write(const int fd,
|
||||
@ -54,7 +62,7 @@ namespace mergerfs
|
||||
FileInfo* fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||
|
||||
rv = _write(fi->fd,buf,count,offset);
|
||||
if(rv == -ENOSPC)
|
||||
if(_out_of_space(-rv))
|
||||
{
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const Config &config = Config::get(fc);
|
||||
|
@ -37,6 +37,14 @@ using std::string;
|
||||
using std::vector;
|
||||
using namespace mergerfs;
|
||||
|
||||
static
|
||||
bool
|
||||
_out_of_space(const int error)
|
||||
{
|
||||
return ((error == ENOSPC) ||
|
||||
(error == EDQUOT));
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_write_buf(const int fd,
|
||||
@ -69,8 +77,8 @@ namespace mergerfs
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||
|
||||
rv = _write_buf(fi->fd,*src,offset);
|
||||
if(rv == -ENOSPC)
|
||||
{
|
||||
if(_out_of_space(-rv))
|
||||
{
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const Config &config = Config::get(fc);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user