mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
bcachefs: Add an option to disable reflink support
Reflink might be buggy, so we're adding an option so users can help bisect what's going on. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
039fc4c522
commit
36b8372b59
4 changed files with 13 additions and 0 deletions
|
@ -1266,6 +1266,8 @@ LE64_BITMASK(BCH_SB_PRJQUOTA, struct bch_sb, flags[0], 59, 60);
|
|||
|
||||
LE64_BITMASK(BCH_SB_HAS_ERRORS, struct bch_sb, flags[0], 60, 61);
|
||||
|
||||
LE64_BITMASK(BCH_SB_REFLINK, struct bch_sb, flags[0], 61, 62);
|
||||
|
||||
/* 61-64 unused */
|
||||
|
||||
LE64_BITMASK(BCH_SB_STR_HASH_TYPE, struct bch_sb, flags[1], 0, 4);
|
||||
|
|
|
@ -2812,6 +2812,9 @@ loff_t bch2_remap_file_range(struct file *file_src, loff_t pos_src,
|
|||
u64 aligned_len;
|
||||
loff_t ret = 0;
|
||||
|
||||
if (!c->opts.reflink)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (remap_flags & ~(REMAP_FILE_DEDUP|REMAP_FILE_ADVISORY))
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -207,6 +207,11 @@ enum opt_type {
|
|||
OPT_BOOL(), \
|
||||
BCH_SB_PRJQUOTA, false, \
|
||||
NULL, "Enable project quotas") \
|
||||
x(reflink, u8, \
|
||||
OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME, \
|
||||
OPT_BOOL(), \
|
||||
BCH_SB_REFLINK, true, \
|
||||
NULL, "Enable reflink support") \
|
||||
x(degraded, u8, \
|
||||
OPT_MOUNT, \
|
||||
OPT_BOOL(), \
|
||||
|
|
|
@ -167,6 +167,9 @@ s64 bch2_remap_range(struct bch_fs *c,
|
|||
u64 src_done, dst_done;
|
||||
int ret = 0, ret2 = 0;
|
||||
|
||||
if (!c->opts.reflink)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (!percpu_ref_tryget(&c->writes))
|
||||
return -EROFS;
|
||||
|
||||
|
|
Loading…
Reference in a new issue