Skip to contentSkip to conversation

Btrfs-progs: more patches for integration

PATCH In review Gene Czarcinski 5 participants 41 messages Jan 20, 2013 – Jan 24, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Btrfs-progs: more patches for integration

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

All of the patches below were applied on top of the 19 bugfix patches pulled together by David Sterba and the 6 patches now part of the Fedora 18 btrfs-progs package. All of this compiles but further testing is obviously needed.

For the most part, these patches are bugfixes and they all appeared resonable but inspection by other eyes would be appreciated. There is also one "simple" function addition in the form or the btrfs-show-super command.

Arvin Schnell (1):
trivial patch for btrfs-progs

Chen Yang (1):
Btrfs-progs: Fix a segmentation fault in btrfstune when <device> is
invalid.

Gene Czarcinski (1):
btrfs-show-super.c

Goffredo Baroncelli (1):
Add btrfs-show-super

Jan Schmidt (2):
Btrfs-progs: correcting misnamed parameter options for btrfs send
Btrfs-progs: bugfix for subvolume parent determination in btrfs send

Nageswara R Sastry (1):
btrfs-progs: btrfs-image.c: Added NULL pointer check.

Nirbheek Chauhan (1):
Btrfs-progs: fix resolving of loop devices

Ulrik (1):
Btrfs-progs: correct btrfs receive usage string

Wang Shilong (4):
Btrfs-progs: fix arg parsing for btrfs qgroup limit commands
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi
with strtoull
Btrfs-progs: check the relation of two group by real level numbers
Btrfs-progs: disable qgroupid 0 for quota_tree

#1 lore raw

PATCH 1/13 btrfs-progs: btrfs-image.c: Added NULL pointer check.

From: Nageswara R Sastry <[email protected]>

Check for the return value of 'open_ctree()' before dereferencing it.

---
 btrfs-image.c | 1 +
 1 file changed, 1 insertion(+)
btrfs-image.c +1 -0
index f2bbcc8..2a33a55 100644
@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, int num_threads,
 	int ret;
 
 	root = open_ctree(input, 0, 0);
+	BUG_ON(!root);
 	BUG_ON(root->nodesize != root->leafsize);
 
 	ret = metadump_init(&metadump, root, out, num_threads,
Signature · 1 line
1.8.1
#6 lore raw

PATCH 2/13 Btrfs-progs: fix resolving of loop devices

In reply to Gene Czarcinski

From: Nirbheek Chauhan <[email protected]>

The LOOP_GET_STATUS ioctl truncates filenames to 64 characters. We should get the backing file for a given loop device from /sys/. This is how losetup does it as well.

---
 utils.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
utils.c +14 -12
index 51b78d5..7953ef9 100644
@@ -20,6 +20,7 @@
 #define __USE_XOPEN2K
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #ifndef __CHECKER__
 #include <sys/ioctl.h>
 #include <sys/mount.h>
@@ -653,21 +654,22 @@ int is_loop_device (const char* device) {
  * the associated file (e.g. /images/my_btrfs.img) */
 int resolve_loop_device(const char* loop_dev, char* loop_file, int max_len)
 {
-	int loop_fd;
-	int ret_ioctl;
-	struct loop_info loopinfo;
+	int ret;
+	FILE *f;
+	char fmt[20];
+	char p[PATH_MAX];
+	char real_loop_dev[PATH_MAX];
 
-	if ((loop_fd = open(loop_dev, O_RDONLY)) < 0)
+	if (!realpath(loop_dev, real_loop_dev))
+		return -errno;
+	snprintf(p, PATH_MAX, "/sys/block/%s/loop/backing_file", strrchr(real_loop_dev, '/'));
+	if (!(f = fopen(p, "r")))
 		return -errno;
 
-	ret_ioctl = ioctl(loop_fd, LOOP_GET_STATUS, &loopinfo);
-	close(loop_fd);
-
-	if (ret_ioctl == 0) {
-		strncpy(loop_file, loopinfo.lo_name, max_len);
-		if (max_len > 0)
-			loop_file[max_len-1] = 0;
-	} else
+	snprintf(fmt, 20, "%%%i[^\n]", max_len-1);
+	ret = fscanf(f, fmt, loop_file);
+	fclose(f);
+	if (ret == EOF)
 		return -errno;
 
 	return 0;
Signature · 1 line
1.8.1
#9 lore raw

PATCH 3/13 Btrfs-progs: correct btrfs receive usage string

In reply to Gene Czarcinski

From: Ulrik <[email protected]>

Fix the usage string to specify the correct '-f' option for input file, not '-i'.

---
 cmds-receive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmds-receive.c +1 -1
index 37d07db..2fae299 100644
@@ -882,7 +882,7 @@ static const char * const receive_cmd_group_usage[] = {
 };
 
 static const char * const cmd_receive_usage[] = {
-	"btrfs receive [-v] [-i <infile>] <mount>",
+	"btrfs receive [-v] [-f <infile>] <mount>",
 	"Receive subvolumes from stdin.",
 	"Receives one or more subvolumes that were previously ",
 	"sent with btrfs send. The received subvolumes are stored",
Signature · 1 line
1.8.1
#10 lore raw

PATCH 4/13 Btrfs-progs: Fix a segmentation fault in btrfstune when <device> is invalid.

In reply to Gene Czarcinski

From: Chen Yang <[email protected]>

When open_ctree(device, ...) failed, the return value should be checked.

---
 btrfstune.c | 2 ++
 1 file changed, 2 insertions(+)
btrfstune.c +2 -0
index 47830c5..07648d5 100644
@@ -107,6 +107,8 @@ int main(int argc, char *argv[])
 	}
 
 	root = open_ctree(device, 0, 1);
+	if (!root)
+		return 1;
 
 	if (seeding_flag) {
 		ret = update_seeding_flag(root, seeding_value);
Signature · 1 line
1.8.1
#11 lore raw

PATCH 5/13 Add btrfs-show-super

In reply to Gene Czarcinski

From: Goffredo Baroncelli <[email protected]>

---
 Makefile           |   5 +-
 btrfs-show-super.c | 284 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 288 insertions(+), 1 deletion(-)
 create mode 100644 btrfs-show-super.c
Makefile +4 -1
index c7fd97d..d524f69 100644
@@ -22,7 +22,7 @@ RESTORE_LIBS=-lz
 
 progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
 	btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
-	btrfs-find-root btrfs-restore btrfstune
+	btrfs-find-root btrfs-restore btrfstune btrfs-show-super
 
 # make C=1 to enable sparse
 ifdef C
@@ -75,6 +75,9 @@ btrfs-debug-tree: $(objects) debug-tree.o
 btrfs-zero-log: $(objects) btrfs-zero-log.o
 	$(CC) $(CFLAGS) -o btrfs-zero-log $(objects) btrfs-zero-log.o $(LDFLAGS) $(LIBS)
 
+btrfs-show-super: $(objects) btrfs-show-super.o
+	$(CC) $(CFLAGS) -o btrfs-show-super $(objects) btrfs-show-super.o $(LDFLAGS) $(LIBS)
+
 btrfs-select-super: $(objects) btrfs-select-super.o
 	$(CC) $(CFLAGS) -o btrfs-select-super $(objects) btrfs-select-super.o $(LDFLAGS) $(LIBS)
 
btrfs-show-super.c new file +284 -0

284 lines not on this page · raw message

Signature · 1 line
1.8.1
#16 lore raw

PATCH 6/13 btrfs-show-super.c

In reply to Gene Czarcinski

remove extra blank line at EOF

---
 btrfs-show-super.c |  1 -
 man/Makefile       | 14 +++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
btrfs-show-super.c +0 -1
index a9e2524..7c66d84 100644
@@ -281,4 +281,3 @@ static void dump_superblock(struct btrfs_super_block *sb)
 	printf("dev_item.generation\t%llu\n", (unsigned long long)
 	       btrfs_stack_device_generation(&sb->dev_item));
 }
-
man/Makefile +7 -7
index 4a90b75..f7b57f7 100644
@@ -1,4 +1,4 @@
-GZIP=gzip
+GZIPCMD=gzip
 INSTALL= install
 
 prefix ?= /usr/local
@@ -12,22 +12,22 @@ MANPAGES = mkfs.btrfs.8.gz btrfsctl.8.gz btrfsck.8.gz btrfs-image.8.gz \
 all: $(MANPAGES)
 
 mkfs.btrfs.8.gz: mkfs.btrfs.8.in
-	$(GZIP) -n -c mkfs.btrfs.8.in > mkfs.btrfs.8.gz
+	$(GZIPCMD) -n -c mkfs.btrfs.8.in > mkfs.btrfs.8.gz
 
 btrfs.8.gz: btrfs.8.in
-	$(GZIP) -n -c btrfs.8.in > btrfs.8.gz
+	$(GZIPCMD) -n -c btrfs.8.in > btrfs.8.gz
 
 btrfsctl.8.gz: btrfsctl.8.in
-	$(GZIP) -n -c btrfsctl.8.in > btrfsctl.8.gz
+	$(GZIPCMD) -n -c btrfsctl.8.in > btrfsctl.8.gz
 
 btrfsck.8.gz: btrfsck.8.in
-	$(GZIP) -n -c btrfsck.8.in > btrfsck.8.gz
+	$(GZIPCMD) -n -c btrfsck.8.in > btrfsck.8.gz
 
 btrfs-image.8.gz: btrfs-image.8.in
-	$(GZIP) -n -c btrfs-image.8.in > btrfs-image.8.gz
+	$(GZIPCMD) -n -c btrfs-image.8.in > btrfs-image.8.gz
 
 btrfs-show.8.gz: btrfs-show.8.in
-	$(GZIP) -n -c btrfs-show.8.in > btrfs-show.8.gz
+	$(GZIPCMD) -n -c btrfs-show.8.in > btrfs-show.8.gz
 
 clean :
 	rm -f $(MANPAGES)
Signature · 1 line
1.8.1
#23 lore raw

PATCH 7/13 Btrfs-progs: correcting misnamed parameter options for btrfs send

In reply to Gene Czarcinski

From: Jan Schmidt <[email protected]>

Unfortunately, the command line options for btrfs send were misnamed. The -i option should not be used to give "clone sources", we'll be using -c instead.

Compatibily note: -i option was broken anyway, which makes it less critical renaming it. For potential users of the old option style, we emit a fatal warning if the -i option is used.

---
 cmds-send.c | 74 +++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 42 insertions(+), 32 deletions(-)
cmds-send.c +42 -32
index 9b47e70..3e2fcbe 100644
@@ -234,7 +234,7 @@ out:
 	return ERR_PTR(ret);
 }
 
-static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root)
+static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root_id)
 {
 	int ret;
 	pthread_t t_read;
@@ -286,7 +286,7 @@ static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root)
 
 	io_send.clone_sources = (__u64*)send->clone_sources;
 	io_send.clone_sources_count = send->clone_sources_count;
-	io_send.parent_root = parent_root;
+	io_send.parent_root = parent_root_id;
 	ret = ioctl(subvol_fd, BTRFS_IOC_SEND, &io_send);
 	if (ret) {
 		ret = -errno;
@@ -423,16 +423,17 @@ int cmd_send_start(int argc, char **argv)
 	char *snapshot_parent = NULL;
 	u64 root_id;
 	u64 parent_root_id = 0;
+	int full_send = 1;
 
 	memset(&send, 0, sizeof(send));
 	send.dump_fd = fileno(stdout);
 
-	while ((c = getopt(argc, argv, "vf:i:p:")) != -1) {
+	while ((c = getopt(argc, argv, "vc:f:i:p:")) != -1) {
 		switch (c) {
 		case 'v':
 			g_verbose++;
 			break;
-		case 'i': {
+		case 'c':
 			subvol = realpath(optarg, NULL);
 			if (!subvol) {
 				ret = -errno;
@@ -454,12 +455,16 @@ int cmd_send_start(int argc, char **argv)
 			}
 			add_clone_source(&send, root_id);
 			free(subvol);
+			full_send = 0;
 			break;
-		}
 		case 'f':
 			outname = optarg;
 			break;
 		case 'p':
+			if (snapshot_parent) {
+				fprintf(stderr, "ERROR: you cannot have more than one parent (-p)\n");
+				return 1;
+			}
 			snapshot_parent = realpath(optarg, NULL);
 			if (!snapshot_parent) {
 				ret = -errno;
@@ -467,7 +472,12 @@ int cmd_send_start(int argc, char **argv)
 						"%s\n", optarg, strerror(-ret));
 				goto out;
 			}
+			full_send = 0;
 			break;
+		case 'i':
+			fprintf(stderr,
+				"ERROR: -i was removed, use -c instead\n");
+			return 1;
 		case '?':
 		default:
 			fprintf(stderr, "ERROR: send args invalid.\n");
@@ -573,10 +583,13 @@ int cmd_send_start(int argc, char **argv)
 			goto out;
 		}
 
-		if (!parent_root_id) {
+		if (!full_send && !parent_root_id) {
 			ret = find_good_parent(&send, root_id, &parent_root_id);
-			if (ret < 0)
-				parent_root_id = 0;
+			if (ret < 0) {
+				fprintf(stderr, "ERROR: parent determination failed for %lld\n",
+					root_id);
+				goto out;
+			}
 		}
 
 		ret = is_subvol_ro(&send, subvol);
@@ -597,6 +610,7 @@ int cmd_send_start(int argc, char **argv)
 		add_clone_source(&send, root_id);
 
 		parent_root_id = 0;
+		full_send = 0;
 		free(subvol);
 	}
 
@@ -614,32 +628,28 @@ static const char * const send_cmd_group_usage[] = {
 };
 
 static const char * const cmd_send_usage[] = {
-	"btrfs send [-v] [-i <subvol>] [-p <parent>] <subvol>",
+	"btrfs send [-v] [-p <parent>] [-c <clone-src>] <subvol>",
 	"Send the subvolume to stdout.",
 	"Sends the subvolume specified by <subvol> to stdout.",
-	"By default, this will send the whole subvolume. To do",
-	"an incremental send, one or multiple '-i <clone_source>'",
-	"arguments have to be specified. A 'clone source' is",
-	"a subvolume that is known to exist on the receiving",
-	"side in exactly the same state as on the sending side.\n",
-	"Normally, a good snapshot parent is searched automatically",
-	"in the list of 'clone sources'. To override this, use",
-	"'-p <parent>' to manually specify a snapshot parent.",
-	"A manually specified snapshot parent is also regarded",
-	"as 'clone source'.\n",
-	"-v               Enable verbose debug output. Each",
-	"                 occurrency of this option increases the",
-	"                 verbose level more.",
-	"-i <subvol>      Informs btrfs send that this subvolume,",
-	"                 can be taken as 'clone source'. This can",
-	"                 be used for incremental sends.",
-	"-p <subvol>      Disable automatic snaphot parent",
-	"                 determination and use <subvol> as parent.",
-	"                 This subvolume is also added to the list",
-	"                 of 'clone sources' (see -i).",
-	"-f <outfile>     Output is normally written to stdout.",
-	"                 To write to a file, use this option.",
-	"                 An alternative would be to use pipes.",
+	"By default, this will send the whole subvolume. To do an incremental",
+	"send, use '-p <parent>'. If you want to allow btrfs to clone from",
+	"any additional local snapshots, use -c <clone-src> (multiple times",
+	"where applicable). You must not specify clone sources unless you",
+	"guarantee that these snapshots are exactly in the same state on both",
+	"sides, the sender and the receiver. It is allowed to omit the",
+	"'-p <parent>' option when '-c <clone-src>' options are given, in",
+	"which case 'btrfs send' will determine a suitable parent among the",
+	"clone sources itself.",
+	"\n",
+	"-v               Enable verbose debug output. Each occurrency of",
+	"                 this option increases the verbose level more.",
+	"-p <parent>      Send an incremental stream from <parent> to",
+	"                 <subvol>.",
+	"-c <clone-src>   Use this snapshot as a clone source for an ",
+	"                 incremental send (multiple allowed)",
+	"-f <outfile>     Output is normally written to stdout. To write to",
+	"                 a file, use this option. An alternative would be to",
+	"                 use pipes.",
 	NULL
 };
 
Signature · 1 line
1.8.1
#26 lore raw

PATCH 8/13 Btrfs-progs: bugfix for subvolume parent determination in btrfs send

In reply to Gene Czarcinski

From: Jan Schmidt <[email protected]>

We missed to add the default subvolume, because it has no ROOT_BACKREF_ITEM. This made get_parent always fail for direct decendants of the default subvolume, resulting in lots of full streams where incremental streams were requested.

---
 send-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
send-utils.c +2 -2
index fcde5c2..d8d3972 100644
@@ -240,7 +240,8 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
 				memcpy(&root_item, root_item_ptr,
 						sizeof(root_item));
 				root_item_valid = 1;
-			} else if (sh->type == BTRFS_ROOT_BACKREF_KEY) {
+			} else if (sh->type == BTRFS_ROOT_BACKREF_KEY ||
+				   root_item_valid) {
 				if (!root_item_valid)
 					goto skip;
 
@@ -274,7 +275,6 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
 				subvol_uuid_search_add(s, si);
 				root_item_valid = 0;
 			} else {
-				root_item_valid = 0;
 				goto skip;
 			}
 
Signature · 1 line
1.8.1
#27 lore raw

PATCH 9/13 Btrfs-progs: fix arg parsing for btrfs qgroup limit commands

In reply to Gene Czarcinski

From: Wang Shilong <[email protected]>

We can use this command in two ways.
1. btrfs qgroup limit size qgroupid path
2. btrfs qgroup limit size path

Before applying this patch, we differentiate them by check the parsing result of the second argument. It is not so good because it may make some mistakes, For example:
btrfs qgroup limit 1M 123456
^ It is a subvolume name.

In fact, we can differentiate them just by the number of arguments, so fix it by this way.

---
 cmds-qgroup.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
cmds-qgroup.c +6 -8
index 1525c11..129a4f0 100644
@@ -383,7 +383,6 @@ static int cmd_qgroup_limit(int argc, char **argv)
 	}
 
 	memset(&args, 0, sizeof(args));
-	args.qgroupid = parse_qgroupid(argv[optind + 1]);
 	if (size) {
 		if (compressed)
 			args.lim.flags |= BTRFS_QGROUP_LIMIT_RFER_CMPR |
@@ -397,9 +396,8 @@ static int cmd_qgroup_limit(int argc, char **argv)
 		}
 	}
 
-	if (args.qgroupid == 0) {
-		if (check_argc_exact(argc - optind, 2))
-			usage(cmd_qgroup_limit_usage);
+	if (argc - optind == 2) {
+		args.qgroupid = 0;
 		path = argv[optind + 1];
 		ret = test_issubvolume(path);
 		if (ret < 0) {
@@ -415,11 +413,11 @@ static int cmd_qgroup_limit(int argc, char **argv)
 		 * keep qgroupid at 0, this indicates that the subvolume the
 		 * fd refers to is to be limited
 		 */
-	} else {
-		if (check_argc_exact(argc - optind, 3))
-			usage(cmd_qgroup_limit_usage);
+	} else if (argc - optind == 3) {
+		args.qgroupid = parse_qgroupid(argv[optind + 1]);
 		path = argv[optind + 2];
-	}
+	} else
+		usage(cmd_qgroup_limit_usage);
 
 	fd = open_file_or_dir(path);
 	if (fd < 0) {
Signature · 1 line
1.8.1
#28 lore raw

PATCH 10/13 Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull

In reply to Gene Czarcinski

From: Wang Shilong <[email protected]>

1. parse_qgroupid() is implemented twice, clean up the reduplicate code.
2. atoi() can not detect errors, so use strtoull() instead of it.

---
 cmds-qgroup.c | 15 +--------------
 qgroup.c      | 22 ++++++++++++++++++----
 qgroup.h      |  2 ++
 3 files changed, 21 insertions(+), 18 deletions(-)
cmds-qgroup.c +1 -14
index 129a4f0..c4122bf 100644
@@ -24,26 +24,13 @@
 #include "ioctl.h"
 
 #include "commands.h"
+#include "qgroup.h"
 
 static const char * const qgroup_cmd_group_usage[] = {
 	"btrfs qgroup <command> [options] <path>",
 	NULL
 };
 
-static u64 parse_qgroupid(char *p)
-{
-	char *s = strchr(p, '/');
-	u64 level;
-	u64 id;
-
-	if (!s)
-		return atoll(p);
-	level = atoll(p);
-	id = atoll(s + 1);
-
-	return (level << 48) | id;
-}
-
 static int qgroup_assign(int assign, int argc, char **argv)
 {
 	int ret = 0;
qgroup.c +18 -4
index 4083b57..dafde12 100644
@@ -22,15 +22,29 @@
 u64 parse_qgroupid(char *p)
 {
 	char *s = strchr(p, '/');
+	char *ptr_src_end = p + strlen(p);
+	char *ptr_parse_end = NULL;
 	u64 level;
 	u64 id;
 
-	if (!s)
-		return atoll(p);
-	level = atoll(p);
-	id = atoll(s + 1);
+	if (!s) {
+		id = strtoull(p, &ptr_parse_end, 10);
+		if (ptr_parse_end != ptr_src_end)
+			goto err;
+		return id;
+	}
+	level = strtoull(p, &ptr_parse_end, 10);
+	if (ptr_parse_end != s)
+		goto err;
+
+	id = strtoull(s+1, &ptr_parse_end, 10);
+	if (ptr_parse_end != ptr_src_end)
+		goto  err;
 
 	return (level << 48) | id;
+err:
+	fprintf(stderr, "ERROR:invalid qgroupid\n");
+	exit(-1);
 }
 
 int qgroup_inherit_size(struct btrfs_qgroup_inherit *p)
qgroup.h +2 -0
index f7af8c5..ad14c88 100644
@@ -20,7 +20,9 @@
 #define _BTRFS_QGROUP_H
 
 #include "ioctl.h"
+#include "kerncompat.h"
 
+u64 parse_qgroupid(char *p);
 int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
 int qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit,
 			   int incgroups, int inccopies);
Signature · 1 line
1.8.1
#29 lore raw

PATCH 11/13 Btrfs-progs: check the relation of two group by real level numbers

In reply to Gene Czarcinski

From: Wang Shilong <[email protected]>

Comparing qgroupid is not good way to check the relationship of two groups, the right way is to compare the real level numbers.

---
 cmds-qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmds-qgroup.c +1 -1
index c4122bf..70019d0 100644
@@ -50,7 +50,7 @@ static int qgroup_assign(int assign, int argc, char **argv)
 	/*
 	 * FIXME src should accept subvol path
 	 */
-	if (args.src >= args.dst) {
+	if ((args.src >> 48) >= (args.dst >> 48)) {
 		fprintf(stderr, "ERROR: bad relation requested '%s'\n", path);
 		return 12;
 	}
Signature · 1 line
1.8.1
#30 lore raw

PATCH 12/13 Btrfs-progs: disable qgroupid 0 for quota_tree

In reply to Gene Czarcinski

From: Wang Shilong <[email protected]>

In kernel, qgroupid 0 is a special number when we run the quota group limit command.

So, we should not be able to create a quota group whose id is 0, otherwise the kernel can't deal with it. Fix it.

---
 cmds-qgroup.c | 4 ++++
 1 file changed, 4 insertions(+)
cmds-qgroup.c +4 -0
index 70019d0..dfff1b9 100644
@@ -86,6 +86,10 @@ static int qgroup_create(int create, int argc, char **argv)
 	args.create = create;
 	args.qgroupid = parse_qgroupid(argv[1]);
 
+	if (!args.qgroupid) {
+		fprintf(stderr, "ERROR: qgroup 0 is not supported\n");
+		return 30;
+	}
 	fd = open_file_or_dir(path);
 	if (fd < 0) {
 		fprintf(stderr, "ERROR: can't access '%s'\n", path);
Signature · 1 line
1.8.1
#32 lore raw

PATCH 13/13 trivial patch for btrfs-progs

In reply to Gene Czarcinski

From: Arvin Schnell <[email protected]>

Hi,

please find attached a trivial patch for btrfs-progs. Likely not strictly needed but I noticed valgrind complaining about uninitialised memory in the ioctl call.

Regards,
Arvin

---
 cmds-send.c | 1 +
 1 file changed, 1 insertion(+)
cmds-send.c +1 -0
index b33c802..595a5d0 100644
@@ -273,6 +273,7 @@ static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root)
 		goto out;
 	}
 
+	memset(&io_send, 0, sizeof(io_send));
 	io_send.send_fd = pipefd[1];
 	send->send_fd = pipefd[0];
 
Signature · 1 line
1.8.1
#24 lore raw

Re: [PATCH 07/13] Btrfs-progs: correcting misnamed parameter options for btrfs send

In reply to Gene Czarcinski

Bad patch ... working on fix

Quoted 13 lines · Gene Czarcinski

From: Jan Schmidt <[email protected]>

Unfortunately, the command line options for btrfs send were misnamed. The -i option should not be used to give "clone sources", we'll be using -c instead.

Compatibily note: -i option was broken anyway, which makes it less critical renaming it. For potential users of the old option style, we emit a fatal warning if the -i option is used.

<snip>

#25 lore raw

PATCH 1/1 Btrfs-progs: correcting misnamed parameter options for btrfs send

In reply to Gene Czarcinski

This is a hand refit of the patch but otherwise the same.

Unfortunately, the command line options for btrfs send were misnamed. The -i option should not be used to give "clone sources", we'll be using -c instead.

Compatibily note: -i option was broken anyway, which makes it less critical renaming it. For potential users of the old option style, we emit a fatal warning if the -i option is used.

---
 cmds-send.c | 74 +++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 42 insertions(+), 32 deletions(-)
cmds-send.c +42 -32
index 5607f2a..d2f7691 100644
@@ -236,7 +236,7 @@ out:
 	return ERR_PTR(ret);
 }
 
-static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root)
+static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root_id)
 {
 	int ret;
 	pthread_t t_read;
@@ -289,7 +289,7 @@ static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root)
 
 	io_send.clone_sources = (__u64*)send->clone_sources;
 	io_send.clone_sources_count = send->clone_sources_count;
-	io_send.parent_root = parent_root;
+	io_send.parent_root = parent_root_id;
 	ret = ioctl(subvol_fd, BTRFS_IOC_SEND, &io_send);
 	if (ret) {
 		ret = -errno;
@@ -426,6 +426,7 @@ int cmd_send_start(int argc, char **argv)
 	char *snapshot_parent = NULL;
 	u64 root_id;
 	u64 parent_root_id = 0;
+	int full_send = 1;
 
 	memset(&send, 0, sizeof(send));
 	send.dump_fd = fileno(stdout);
@@ -435,12 +436,12 @@ int cmd_send_start(int argc, char **argv)
 		return 1;
 	}
 
-	while ((c = getopt(argc, argv, "vf:i:p:")) != -1) {
+	while ((c = getopt(argc, argv, "vc:f:i:p:")) != -1) {
 		switch (c) {
 		case 'v':
 			g_verbose++;
 			break;
-		case 'i': {
+		case 'c':
 			subvol = realpath(optarg, NULL);
 			if (!subvol) {
 				ret = -errno;
@@ -462,12 +463,16 @@ int cmd_send_start(int argc, char **argv)
 			}
 			add_clone_source(&send, root_id);
 			free(subvol);
+			full_send = 0;
 			break;
-		}
 		case 'f':
 			outname = optarg;
 			break;
 		case 'p':
+			if (snapshot_parent) {
+				fprintf(stderr, "ERROR: you cannot have more than one parent (-p)\n");
+				return 1;
+			}
 			snapshot_parent = realpath(optarg, NULL);
 			if (!snapshot_parent) {
 				ret = -errno;
@@ -475,7 +480,12 @@ int cmd_send_start(int argc, char **argv)
 						"%s\n", optarg, strerror(-ret));
 				goto out;
 			}
+			full_send = 0;
 			break;
+		case 'i':
+			fprintf(stderr,
+				"ERROR: -i was removed, use -c instead\n");
+			return 1;
 		case '?':
 		default:
 			fprintf(stderr, "ERROR: send args invalid.\n");
@@ -581,10 +591,13 @@ int cmd_send_start(int argc, char **argv)
 			goto out;
 		}
 
-		if (!parent_root_id) {
+		if (!full_send && !parent_root_id) {
 			ret = find_good_parent(&send, root_id, &parent_root_id);
-			if (ret < 0)
-				parent_root_id = 0;
+			if (ret < 0) {
+				fprintf(stderr, "ERROR: parent determination failed for %lld\n",
+					root_id);
+				goto out;
+			}
 		}
 
 		ret = is_subvol_ro(&send, subvol);
@@ -605,6 +618,7 @@ int cmd_send_start(int argc, char **argv)
 		add_clone_source(&send, root_id);
 
 		parent_root_id = 0;
+		full_send = 0;
 		free(subvol);
 	}
 
@@ -622,32 +636,28 @@ static const char * const send_cmd_group_usage[] = {
 };
 
 static const char * const cmd_send_usage[] = {
-	"btrfs send [-v] [-i <subvol>] [-p <parent>] <subvol>",
+	"btrfs send [-v] [-p <parent>] [-c <clone-src>] <subvol>",
 	"Send the subvolume to stdout.",
 	"Sends the subvolume specified by <subvol> to stdout.",
-	"By default, this will send the whole subvolume. To do",
-	"an incremental send, one or multiple '-i <clone_source>'",
-	"arguments have to be specified. A 'clone source' is",
-	"a subvolume that is known to exist on the receiving",
-	"side in exactly the same state as on the sending side.\n",
-	"Normally, a good snapshot parent is searched automatically",
-	"in the list of 'clone sources'. To override this, use",
-	"'-p <parent>' to manually specify a snapshot parent.",
-	"A manually specified snapshot parent is also regarded",
-	"as 'clone source'.\n",
-	"-v               Enable verbose debug output. Each",
-	"                 occurrency of this option increases the",
-	"                 verbose level more.",
-	"-i <subvol>      Informs btrfs send that this subvolume,",
-	"                 can be taken as 'clone source'. This can",
-	"                 be used for incremental sends.",
-	"-p <subvol>      Disable automatic snaphot parent",
-	"                 determination and use <subvol> as parent.",
-	"                 This subvolume is also added to the list",
-	"                 of 'clone sources' (see -i).",
-	"-f <outfile>     Output is normally written to stdout.",
-	"                 To write to a file, use this option.",
-	"                 An alternative would be to use pipes.",
+	"By default, this will send the whole subvolume. To do an incremental",
+	"send, use '-p <parent>'. If you want to allow btrfs to clone from",
+	"any additional local snapshots, use -c <clone-src> (multiple times",
+	"where applicable). You must not specify clone sources unless you",
+	"guarantee that these snapshots are exactly in the same state on both",
+	"sides, the sender and the receiver. It is allowed to omit the",
+	"'-p <parent>' option when '-c <clone-src>' options are given, in",
+	"which case 'btrfs send' will determine a suitable parent among the",
+	"clone sources itself.",
+	"\n",
+	"-v               Enable verbose debug output. Each occurrency of",
+	"                 this option increases the verbose level more.",
+	"-p <parent>      Send an incremental stream from <parent> to",
+	"                 <subvol>.",
+	"-c <clone-src>   Use this snapshot as a clone source for an ",
+	"                 incremental send (multiple allowed)",
+	"-f <outfile>     Output is normally written to stdout. To write to",
+	"                 a file, use this option. An alternative would be to",
+	"                 use pipes.",
 	NULL
 };
 
Signature · 1 line
1.8.1
#31 lore raw

Re: [PATCH 12/13] Btrfs-progs: disable qgroupid 0 for quota_tree

In reply to Gene Czarcinski

At the request of the patch's author, this should be dropped as it has been addressed by a patch to the kernel.

Quoted 29 lines · Gene Czarcinski

From: Wang Shilong <[email protected]>

In kernel, qgroupid 0 is a special number when we run the quota group limit command.

So, we should not be able to create a quota group whose id is 0, otherwise the kernel can't deal with it. Fix it.

---
  cmds-qgroup.c | 4 ++++
  1 file changed, 4 insertions(+)
cmds-qgroup.c +4 -0
index 70019d0..dfff1b9 100644
@@ -86,6 +86,10 @@ static int qgroup_create(int create, int argc, char **argv)
  	args.create = create;
  	args.qgroupid = parse_qgroupid(argv[1]);
 
+	if (!args.qgroupid) {
+		fprintf(stderr, "ERROR: qgroup 0 is not supported\n");
+		return 30;
+	}
  	fd = open_file_or_dir(path);
  	if (fd < 0) {
  		fprintf(stderr, "ERROR: can't access '%s'\n", path);
#2 lore raw

Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

In reply to Gene Czarcinski

btrfs-image.c static int create_metadump(const char *input, FILE *out, int num_threads, · line 494

Quoted 11 lines · Gene Czarcinski

From: Nageswara R Sastry <[email protected]>

Check for the return value of 'open_ctree()' before dereferencing it.

btrfs-image.c +1 -0
@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, int num_threads,
 	int ret;
 
 	root = open_ctree(input, 0, 0);
+	BUG_ON(!root);

Bug_on is not the right fix here, I prefer a more extensive fix

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/15305

which prints a message and exits.

Quoted 3 lines
btrfs-image.c +0 -0
 	BUG_ON(root->nodesize != root->leafsize);
 
 	ret = metadump_init(&metadump, root, out, num_threads,
Tested-by Hector Oron on v1 2/13
#7 lore raw

Re: [PATCH 02/13] Btrfs-progs: fix resolving of loop devices

In reply to Gene Czarcinski
Quoted 7 lines · Gene Czarcinski

From: Nirbheek Chauhan <[email protected]>

The LOOP_GET_STATUS ioctl truncates filenames to 64 characters. We should get the backing file for a given loop device from /sys/. This is how losetup does it as well.

I'd expect Nirbheek's signed off here as well and I've noticed

(https://patchwork.kernel.org/patch/1629581/)

Are you guys ok with adding them?

david

#17 lore raw

Re: [PATCH 06/13] btrfs-show-super.c

In reply to Gene Czarcinski
Quoted 1 line · Gene Czarcinski

remove extra blank line at EOF

The patch contents and description do not match.

man/Makefile line 1

Quoted 5 lines
man/Makefile +1 -1
@@ -1,4 +1,4 @@
-GZIP=gzip
+GZIPCMD=gzip

I'm not sure if this change is needed, does it stick to some well-known or established style in makefiles?

david

#33 lore raw

Re: [PATCH 13/13] trivial patch for btrfs-progs

In reply to Gene Czarcinski
Quoted 4 lines · Gene Czarcinski

From: Arvin Schnell <[email protected]>

Hi,

Quoted 8 lines

please find attached a trivial patch for btrfs-progs. Likely not strictly needed but I noticed valgrind complaining about uninitialised memory in the ioctl call.

Regards,
Arvin

I've updated the changelog to say
---
btrfs-progs: initialize data before send ioctl

Likely not strictly needed but I noticed valgrind complaining about uninitialised memory in the ioctl call.

---

is it ok for both of you?

david

#35 lore raw

Re: [PATCH 00/13] Btrfs-progs: more patches for integration (integration-20130121)

In reply to Gene Czarcinski
Quoted 3 lines · Gene Czarcinski

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

Thanks, I went through them and put together into an integration branch

git://repo.or.cz/btrfs-progs-unstable/devel.git integration-20130121

I've modified the signed-off-by lines when I knew who was the author or contributed to the patch. Please let me know if I've messed the credits and fame attribution.

There are three more patches that I've picked from my distro patch queue (and were sent to the list long ago) they're placed at the top of the shortlog.

Arne Jansen (1):
Btrfs-progs: bugfix for scrubbing single devices

Wang Sheng-Hui (1):
btrfs-progs: add malloc check in transaction.h/btrfs_start_transaction

Goffredo Baroncelli (1):
Ignore the error ENXIO and ENOMEDIUM during a devs scan

Arvin Schnell (1):
btrfs-progs: initialize data before send ioctl

Danny Kukawka (1):
btrfs-progs: Handle errors returned from open_ctree

Jan Schmidt (2):
Btrfs-progs: correcting misnamed parameter options for btrfs send
Btrfs-progs: bugfix for subvolume parent determination in btrfs send

Josef Bacik (2):
Btrfs-progs: detect if the disk we are formatting is a ssd
Btrfs-progs: add btrfs device ready command

Nirbheek Chauhan (1):
Btrfs-progs: fix resolving of loop devices

Stefan Behrens (1):
btrfs-progs: Add btrfs-show-super

Ulrik (1):
Btrfs-progs: correct btrfs receive usage string

Wang Shilong (3):
Btrfs-progs: fix arg parsing for btrfs qgroup limit commands
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull
Btrfs-progs: check the relation of two group by real level numbers

david

#13 lore raw

Re: [PATCH 05/13] Add btrfs-show-super

In reply to David Sterba
Quoted 6 lines · David Sterba
Quoted 2 lines · Gene Czarcinski

From: Goffredo Baroncelli<[email protected]>

What I'm missing here is Stefan's S-o-B line, as he's the original author of the tool, adding it, JFYI.

I am not sure if he want to Sign it. During the review he blamed about some style issues. But for time constraints I was not able to update the patches.

So before adding Stefen's S-o-B we need an ack from him.

Quoted 9 lines
Quoted 2 lines

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5
#14 lore raw

Re: [PATCH 05/13] Add btrfs-show-super

Quoted 4 lines · Goffredo Baroncelli
Quoted 3 lines · David Sterba
Quoted 2 lines · Gene Czarcinski

From: Goffredo Baroncelli<[email protected]>

Quoted 8 lines
Quoted 2 lines

What I'm missing here is Stefan's S-o-B line, as he's the original author of the tool, adding it, JFYI.

I am not sure if he want to Sign it. During the review he blamed about some style issues. But for time constraints I was not able to update the patches.

So before adding Stefen's S-o-B we need an ack from him.

For the record, all the extra spaces are not from me.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
#15 lore raw

Re: [PATCH 05/13] Add btrfs-show-super

Quoted 8 lines · Stefan Behrens
Quoted 7 lines · Goffredo Baroncelli
Quoted 5 lines · David Sterba
Quoted 2 lines · Gene Czarcinski

From: Goffredo Baroncelli<[email protected]>

What I'm missing here is Stefan's S-o-B line, as he's the original author of the tool, adding it, JFYI.

Quoted 7 lines
Quoted 5 lines

I am not sure if he want to Sign it. During the review he blamed about some style issues. But for time constraints I was not able to update the patches.

So before adding Stefen's S-o-B we need an ack from him.

For the record, all the extra spaces are not from me.

Thanks, s-o-b is there and I've removed them and added

@@ -125,7 +125,7 @@ int main(int argc, char **argv)

static int load_and_dump_sb(char *filename, int fd, u64 sb_bytenr) {
- u8 super_block_data[BTRFS_SUPER_INFO_SIZE];

+       u8 super_block_data[BTRFS_SUPER_INFO_SIZE];
        struct btrfs_super_block *sb;
        u64 ret;

@@ -166,12 +166,12 @@ static int check_csum_sblock(void *sb, int csum_size)

static void dump_superblock(struct btrfs_super_block *sb) {

-       int     i;
-       char    *s, buf[36+1];
-       u8      *p;
+       int i;
+       char *s, buf[36+1];
+       u8 *p;

---

also a whitespace change, that sticks to the common style in progs.

david

#37 lore raw

cover Btrfs-progs: more patches for integration (integration-20130121)

In reply to a message not in the archive

Hello,
We are team of 5 students, interns at Green turtles technologies, interested in contributing to btrfs.
Any space for contribution for btrfs testing ? we will be updating pogress twice in a week.
Need suggestions on how to proceed.

Quoted 53 lines · David Sterba
Quoted 3 lines · Gene Czarcinski

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

Thanks, I went through them and put together into an integration branch

git://repo.or.cz/btrfs-progs-unstable/devel.git integration-20130121

I've modified the signed-off-by lines when I knew who was the author or contributed to the patch. Please let me know if I've messed the credits and fame attribution.

There are three more patches that I've picked from my distro patch queue (and were sent to the list long ago) they're placed at the top of the shortlog.

Arne Jansen (1):
Btrfs-progs: bugfix for scrubbing single devices

Wang Sheng-Hui (1):
btrfs-progs: add malloc check in transaction.h/btrfs_start_transaction

Goffredo Baroncelli (1):
Ignore the error ENXIO and ENOMEDIUM during a devs scan

Arvin Schnell (1):
btrfs-progs: initialize data before send ioctl

Danny Kukawka (1):
btrfs-progs: Handle errors returned from open_ctree

Jan Schmidt (2):
Btrfs-progs: correcting misnamed parameter options for btrfs send
Btrfs-progs: bugfix for subvolume parent determination in btrfs send

Josef Bacik (2):
Btrfs-progs: detect if the disk we are formatting is a ssd
Btrfs-progs: add btrfs device ready command

Nirbheek Chauhan (1):
Btrfs-progs: fix resolving of loop devices

Stefan Behrens (1):
btrfs-progs: Add btrfs-show-super

Ulrik (1):
Btrfs-progs: correct btrfs receive usage string

Wang Shilong (3):
Btrfs-progs: fix arg parsing for btrfs qgroup limit commands
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull
Btrfs-progs: check the relation of two group by real level numbers

Quoted 5 lines

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Praneeth U
9448804728

--
Praneeth U
9448804728

#3 lore raw

Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

In reply to David Sterba
Quoted 10 lines · David Sterba
Quoted 9 lines · Gene Czarcinski

From: Nageswara R Sastry <[email protected]>

Check for the return value of 'open_ctree()' before dereferencing it.

btrfs-image.c +0 -0
@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, int num_threads,
  	int ret;
 
Quoted 11 lines

btrfs-image.c static int create_metadump(const char *input, FILE *out, int num_threads, · line 494

Quoted 2 lines
btrfs-image.c +1 -0
  	root = open_ctree(input, 0, 0);
+	BUG_ON(!root);

Bug_on is not the right fix here, I prefer a more extensive fix

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/15305

which prints a message and exits.

Quoted 3 lines
btrfs-image.c +0 -0
  	BUG_ON(root->nodesize != root->leafsize);
 
  	ret = metadump_init(&metadump, root, out, num_threads,

I missed this better fix because I only started looking for outstanding patches starting in June/July 2012.

Besides, I suspect you are a lot more knowledgeable to make the judgment as to a "good" fix.

Gene

#8 lore raw

Re: [PATCH 02/13] Btrfs-progs: fix resolving of loop devices

In reply to Gene Czarcinski
Quoted 5 lines · Gene Czarcinski

From: Nirbheek Chauhan <[email protected]>

The LOOP_GET_STATUS ioctl truncates filenames to 64 characters. We should get the backing file for a given loop device from /sys/. This is how losetup does it as well.

For the record, there was another patch fixing a loop device issue

https://patchwork.kernel.org/patch/1861831/

from Michael (CCed), that switched from LOOP_GET_STATUS to LOOP_GET_STATUS64, but afaics both types of the ioctl return at most 64 characters, so parsing /sys appears to be the way to go.

david

#18 lore raw

Re: [PATCH 06/13] btrfs-show-super.c

In reply to David Sterba
Quoted 3 lines · David Sterba
Quoted 1 line · Gene Czarcinski

remove extra blank line at EOF

The patch contents and description do not match.

First of all, this patch should have been 2 separate patches. Too late to fix that.

The patch which created btrfs-show-super.c had an extra line at the end and I got annoyed at git-am complaining about it. This first patch fixes that. This should have been a separate commit.

The other patch (which should have been its own commit) addresses this problem:
http://www.mail-archive.com/[email protected]/msg19264.html

I could not see that it did any harm and it helped on at least one system type

I am not sure how it happened that I combined them. If you want, I will resubmit them the way it should be ... two separate patches with two separate commits.

Gene

Quoted 12 lines

man/Makefile line 1

Quoted 6 lines
man/Makefile +1 -1
@@ -1,4 +1,4 @@
-GZIP=gzip
+GZIPCMD=gzip

I'm not sure if this change is needed, does it stick to some well-known or established style in makefiles?

david

#38 lore raw

Re: [PATCH 00/13] Btrfs-progs: more patches for integration (integration-20130121)

In reply to David Sterba

Thanks. I am currently running with all of my submissions and everything is working. I will pull your integration branch and switch to that instead of 13 patch set so I can test them. This will be on top of the "original" two sets of patches.

Gene

Quoted 55 lines · David Sterba
Quoted 3 lines · Gene Czarcinski

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

Thanks, I went through them and put together into an integration branch

   git://repo.or.cz/btrfs-progs-unstable/devel.git integration-20130121

I've modified the signed-off-by lines when I knew who was the author or contributed to the patch. Please let me know if I've messed the credits and fame attribution.

There are three more patches that I've picked from my distro patch queue (and were sent to the list long ago) they're placed at the top of the shortlog.

Arne Jansen (1):
Btrfs-progs: bugfix for scrubbing single devices

Wang Sheng-Hui (1):
btrfs-progs: add malloc check in transaction.h/btrfs_start_transaction

Goffredo Baroncelli (1):
Ignore the error ENXIO and ENOMEDIUM during a devs scan

Arvin Schnell (1):
btrfs-progs: initialize data before send ioctl

Danny Kukawka (1):
btrfs-progs: Handle errors returned from open_ctree

Jan Schmidt (2):
Btrfs-progs: correcting misnamed parameter options for btrfs send
Btrfs-progs: bugfix for subvolume parent determination in btrfs send

Josef Bacik (2):
Btrfs-progs: detect if the disk we are formatting is a ssd
Btrfs-progs: add btrfs device ready command

Nirbheek Chauhan (1):
Btrfs-progs: fix resolving of loop devices

Stefan Behrens (1):
btrfs-progs: Add btrfs-show-super

Ulrik (1):
Btrfs-progs: correct btrfs receive usage string

Wang Shilong (3):
Btrfs-progs: fix arg parsing for btrfs qgroup limit commands
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull
Btrfs-progs: check the relation of two group by real level numbers

david

#34 lore raw

Re: [PATCH 13/13] trivial patch for btrfs-progs

In reply to David Sterba
Quoted 20 lines · David Sterba
Quoted 4 lines · Gene Czarcinski

From: Arvin Schnell <[email protected]>

Hi,

Quoted 8 lines

please find attached a trivial patch for btrfs-progs. Likely not strictly needed but I noticed valgrind complaining about uninitialised memory in the ioctl call.

Regards,
Arvin

I've updated the changelog to say
---
btrfs-progs: initialize data before send ioctl

Likely not strictly needed but I noticed valgrind complaining about uninitialised memory in the ioctl call.

Quoted 7 lines

---

is it ok for both of you?

david

Of course. It is usually a good thing to not make assumptions where you do not have to.

Gene

#39 lore raw

Re: [PATCH 00/13] Btrfs-progs: more patches for integration (integration-20130121)

In reply to David Sterba
Quoted 7 lines · David Sterba
Quoted 3 lines · Gene Czarcinski
Quoted 3 lines

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

Thanks, I went through them and put together into an integration branch

   git://repo.or.cz/btrfs-progs-unstable/devel.git integration-20130121

There is a problem with one of the patches:
detect if the disk we are formatting is a ssd

The commit comments appear to come from the patch I submitted. However, as I said in the submission, the patch for mkfs.c has to be "refitted" because of a conflict. The conflict is a result of the patch:
Fix compiler warnings on PPC64
which relocated the include "kerncompat.h" to a different line in the mkfs.c file.

It appears that you used the original patch. I noticed that you merged from a different branch and I suspect that that branch did not have the "Fix compiler warnings" patch applied first.

I suggest you use the patch I submitted.

Gene

#21 lore raw

PATCH 1/1 fix btrfs-progs build

From: Christian Hesse <[email protected]>

Hello everybody,

man pages for btrfs-progs are compressed by gzip by default. In Makefile the variable GZIP is use, this evaluates to 'gzip gzip' on my system. From man gzip:

Quoted 3 lines

The environment variable GZIP can hold a set of default options for gzip. These options are interpreted first and can be overwritten by explicit command line parameters.

So using any other variable name fixes this. Patch is attached.

---
 man/Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
man/Makefile +7 -7
index 4a90b75..f7b57f7 100644
@@ -1,4 +1,4 @@
-GZIP=gzip
+GZIPCMD=gzip
 INSTALL= install
 
 prefix ?= /usr/local
@@ -12,22 +12,22 @@ MANPAGES = mkfs.btrfs.8.gz btrfsctl.8.gz btrfsck.8.gz btrfs-image.8.gz \
 all: $(MANPAGES)
 
 mkfs.btrfs.8.gz: mkfs.btrfs.8.in
-	$(GZIP) -n -c mkfs.btrfs.8.in > mkfs.btrfs.8.gz
+	$(GZIPCMD) -n -c mkfs.btrfs.8.in > mkfs.btrfs.8.gz
 
 btrfs.8.gz: btrfs.8.in
-	$(GZIP) -n -c btrfs.8.in > btrfs.8.gz
+	$(GZIPCMD) -n -c btrfs.8.in > btrfs.8.gz
 
 btrfsctl.8.gz: btrfsctl.8.in
-	$(GZIP) -n -c btrfsctl.8.in > btrfsctl.8.gz
+	$(GZIPCMD) -n -c btrfsctl.8.in > btrfsctl.8.gz
 
 btrfsck.8.gz: btrfsck.8.in
-	$(GZIP) -n -c btrfsck.8.in > btrfsck.8.gz
+	$(GZIPCMD) -n -c btrfsck.8.in > btrfsck.8.gz
 
 btrfs-image.8.gz: btrfs-image.8.in
-	$(GZIP) -n -c btrfs-image.8.in > btrfs-image.8.gz
+	$(GZIPCMD) -n -c btrfs-image.8.in > btrfs-image.8.gz
 
 btrfs-show.8.gz: btrfs-show.8.in
-	$(GZIP) -n -c btrfs-show.8.in > btrfs-show.8.gz
+	$(GZIPCMD) -n -c btrfs-show.8.in > btrfs-show.8.gz
 
 clean :
 	rm -f $(MANPAGES)
Signature · 6 lines
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-
#4 lore raw

Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

In reply to Gene Czarcinski
Quoted 2 lines · Gene Czarcinski

I missed this better fix because I only started looking for outstanding patches starting in June/July 2012.

No problem, there are multuple patches for some longstanging bugs, or several versions of patch series. This is something we need to be able to deal with anyway.

david

#19 lore raw

Re: [PATCH 06/13] btrfs-show-super.c

In reply to Gene Czarcinski
Quoted 3 lines · Gene Czarcinski

The patch which created btrfs-show-super.c had an extra line at the end and I got annoyed at git-am complaining about it. This first patch fixes that. This should have been a separate commit.

No need to send separate patches for whitespaces if the number of places to fix is small.

Quoted 6 lines

The other patch (which should have been its own commit) addresses this problem:
http://www.mail-archive.com/[email protected]/msg19264.html

I could not see that it did any harm and it helped on at least one system type

Now I remember I saw that patch fly by; added to the queue.

david

#22 lore raw

Re: [PATCH] fix btrfs-progs build

In reply to Gene Czarcinski
Quoted 8 lines · Gene Czarcinski

From: Christian Hesse <[email protected]>

Hello everybody,

man pages for btrfs-progs are compressed by gzip by default. In Makefile the variable GZIP is use, this evaluates to 'gzip gzip' on my system. From man gzip:

Quoted 5 lines
Quoted 3 lines

The environment variable GZIP can hold a set of default options for gzip. These options are interpreted first and can be overwritten by explicit command line parameters.

So using any other variable name fixes this. Patch is attached.

I've added Christian's

and modified the subject line to say

"btrfs-progs: fix build, manpage compression command"

david

#5 lore raw

Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

In reply to David Sterba
Quoted 10 lines · David Sterba
Quoted 9 lines · Gene Czarcinski
Quoted 9 lines

From: Nageswara R Sastry<[email protected]>

Check for the return value of 'open_ctree()' before dereferencing it.

btrfs-image.c +0 -0
@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, int num_threads,
 	int ret;
 
Quoted 8 lines
Quoted 2 lines

btrfs-image.c static int create_metadump(const char *input, FILE *out, int num_threads, · line 494

Quoted 2 lines
btrfs-image.c +1 -0
 	root = open_ctree(input, 0, 0);
+	BUG_ON(!root);

Bug_on is not the right fix here, I prefer a more extensive fix

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/15305

which prints a message and exits.

The above patch is 1 of 4 that were submitted. Should those other three be included also. I did a couple of spot checks and the changes were not picked up in another patch.

A couple of things bother me about these 4 patches. First of all, nobody commented about them on this mailing list --- either good or bad. Second, if the descriptions and code is at all accurate, why were these patches not included in the "flury" of patches applied later in the year to bring btrfs-progs more up-to-date?

These patches may "look good" but almost none of the changes will apply to "integration-20130121" or "91d9eec".
So some effort will be needed to refit/rebase these patches. I am willing to do that if there is some agreement that this should be done. Of the 4 patches, the one addressing segfaults is the most serious. The others deal with simple problems including one which changes spaces to tab characters.

Gene

#40 lore raw

Re: [PATCH 00/13] Btrfs-progs: more patches for integration (integration-20130121)

In reply to Gene Czarcinski
Quoted 11 lines · Gene Czarcinski
Quoted 7 lines · David Sterba
Quoted 3 lines · Gene Czarcinski
Quoted 3 lines

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

Thanks, I went through them and put together into an integration branch

git://repo.or.cz/btrfs-progs-unstable/devel.git integration-20130121

There is a problem with one of the patches:
detect if the disk we are formatting is a ssd

Quoted 6 lines

The commit comments appear to come from the patch I submitted. However, as I said in the submission, the patch for mkfs.c has to be "refitted" because of a conflict. The conflict is a result of the patch:
Fix compiler warnings on PPC64
which relocated the include "kerncompat.h" to a different line in the mkfs.c file.

These merge conflicts are inevitable and normal (though sometimes not that trivial). My initial aim was to build one linear branch only with fixes and git-merge the patches that add features, but this will not be easy to merge for much longer, so I'm going to do a linear integration branch so others can take them as checkpoint to base the various patchsets.

david

#41 lore raw

Re: [PATCH 00/13] Btrfs-progs: more patches for integration (integration-20130121)

Quoted 18 lines · David Sterba
Quoted 11 lines · Gene Czarcinski
Quoted 7 lines · David Sterba
Quoted 3 lines · Gene Czarcinski
Quoted 3 lines

I have done some additional scraping of the mailing list to identify some "low hanging fruit" which I consider should be merged into the btrfs-progs repository.

Thanks, I went through them and put together into an integration branch

   git://repo.or.cz/btrfs-progs-unstable/devel.git integration-20130121

There is a problem with one of the patches:
detect if the disk we are formatting is a ssd

Quoted 6 lines

The commit comments appear to come from the patch I submitted. However, as I said in the submission, the patch for mkfs.c has to be "refitted" because of a conflict. The conflict is a result of the patch:
Fix compiler warnings on PPC64
which relocated the include "kerncompat.h" to a different line in the mkfs.c file.

Quoted 7 lines

These merge conflicts are inevitable and normal (though sometimes not that trivial). My initial aim was to build one linear branch only with fixes and git-merge the patches that add features, but this will not be easy to merge for much longer, so I'm going to do a linear integration branch so others can take them as checkpoint to base the various patchsets.

Yes, trying to merge branches with lots of changes are effectively impossible (impractical?) as far as I am concerned. Unless it is simple I I understand exactly what is happening, I have found it easier/better to apply a set of patches one at a time and resolve problems manually.

I just got the subvol show patches applied. I tried putting it into a separate branch and then doing a merge but I could not trust my results when I ran mergetool. And, BTW they subvol show patches to apply with not very many problems. My working branch currently has 44 commits over 91d9eec and subvol show added another ten.

Gene