aboutsummaryrefslogtreecommitdiff
path: root/sbin/mdconfig/mdconfig.c
diff options
context:
space:
mode:
authorKa Ho Ng <khng@FreeBSD.org>2021-09-11 12:03:38 +0000
committerKa Ho Ng <khng@FreeBSD.org>2021-09-11 12:04:52 +0000
commit3703c18883341f3ff09c42d7f3b36ab80e4a071b (patch)
tree2463648a1f0b2dc6446e65cfcac0de59bcc33d66 /sbin/mdconfig/mdconfig.c
parent71a1ae7cebd3791d4d18ac9620a7a4ce8cf15819 (diff)
downloadsrc-3703c18883341f3ff09c42d7f3b36ab80e4a071b.tar.gz
src-3703c18883341f3ff09c42d7f3b36ab80e4a071b.zip
md: Add MD_MUSTDEALLOC support
This adds an option to detect if hole-punching is implemented by the underlying file system. If this flag is set, and if the underlying file system does not support hole-punching, md(4) fails BIO_DELETE requests with EOPNOTSUPP. Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31883
Diffstat (limited to 'sbin/mdconfig/mdconfig.c')
-rw-r--r--sbin/mdconfig/mdconfig.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 0f76ca6149f1..9f4f3fc3a392 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -89,7 +89,8 @@ usage(void)
" mdconfig file\n");
fprintf(stderr, "\t\ttype = {malloc, vnode, swap}\n");
fprintf(stderr, "\t\toption = {cache, cluster, compress, force,\n");
- fprintf(stderr, "\t\t readonly, reserve, ro, verify}\n");
+ fprintf(stderr, "\t\t mustdealloc, readonly, reserve, ro,\n");
+ fprintf(stderr, "\t\t verify}\n");
fprintf(stderr, "\t\tsize = %%d (512 byte blocks), %%db (B),\n");
fprintf(stderr, "\t\t %%dk (kB), %%dm (MB), %%dg (GB), \n");
fprintf(stderr, "\t\t %%dt (TB), or %%dp (PB)\n");
@@ -194,6 +195,10 @@ main(int argc, char **argv)
mdio.md_options |= MD_FORCE;
else if (!strcmp(optarg, "noforce"))
mdio.md_options &= ~MD_FORCE;
+ else if (!strcmp(optarg, "mustdealloc"))
+ mdio.md_options |= MD_MUSTDEALLOC;
+ else if (!strcmp(optarg, "nomustdealloc"))
+ mdio.md_options &= ~MD_MUSTDEALLOC;
else if (!strcmp(optarg, "readonly"))
mdio.md_options |= MD_READONLY;
else if (!strcmp(optarg, "noreadonly"))