aboutsummaryrefslogtreecommitdiffstats
path: root/tools-util.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-03-16 21:37:23 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2021-03-16 21:46:21 -0400
commitcc92b0f5a2459456d735ed0fb93c0d819df3ccec (patch)
treec63872c9f1977f242cadbf68da4bf5bf008c6be4 /tools-util.c
parentaa0ddf3cf900cbcf14d5eb3d42638cc4ebb18cf7 (diff)
downloadbcachefs-tools-cc92b0f5a2459456d735ed0fb93c0d819df3ccec.tar.gz
New data job command
This adds a new subcommand, bcachefs data job, that gives more direct access to the data job/ioctl functionality, and hooks up the new rewrite old nodes data job.
Diffstat (limited to 'tools-util.c')
-rw-r--r--tools-util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools-util.c b/tools-util.c
index 88e923cb..361419ae 100644
--- a/tools-util.c
+++ b/tools-util.c
@@ -663,3 +663,22 @@ int dev_mounted(char *dev)
return 1;
return 2;
}
+
+struct bpos bpos_parse(char *buf)
+{
+ char *s = buf, *field;
+ u64 inode_v = 0, offset_v = 0;
+
+ if (!(field = strsep(&s, ":")) ||
+ kstrtoull(field, 10, &inode_v))
+ die("invalid bpos %s", buf);
+
+ if ((field = strsep(&s, ":")) &&
+ kstrtoull(field, 10, &offset_v))
+ die("invalid bpos %s", buf);
+
+ if (s)
+ die("invalid bpos %s", buf);
+
+ return (struct bpos) { .inode = inode_v, .offset = offset_v };
+}