Browse Source

add EDQUOT to errors which trigger moveonenospc

pull/324/head
Antonio SJ Musumeci 8 years ago
parent
commit
3fb7f8919a
  1. 2
      README.md
  2. 6
      man/mergerfs.1
  3. 10
      src/write.cpp
  4. 10
      src/write_buf.cpp

2
README.md

@ -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.

6
man/mergerfs.1

@ -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.

10
src/write.cpp

@ -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);

10
src/write_buf.cpp

@ -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,7 +77,7 @@ 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…
Cancel
Save