Hello community,
here is the log from the commit of package btrfsprogs for openSUSE:Factory
checked in at Tue Mar 9 16:56:11 CET 2010.
--------
--- btrfsprogs/btrfsprogs.changes 2010-01-22 22:29:05.000000000 +0100
+++ /mounts/work_src_done/STABLE/btrfsprogs/btrfsprogs.changes 2010-03-04 22:49:32.000000000 +0100
@@ -1,0 +2,9 @@
+Thu Mar 4 22:48:17 CET 2010 - jeffm@suse.de
+
+- Updated to latest repo version.
+ - used space accounting fix for the converter
+ - btrfsctl: add snapshot/subvolume destroy ioctl
+ - btrfsck: check root back/forward references
+ - Add btrfs-map-logical program to map and read logical block numbers
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
0001-used-space-accounting-fix-for-the-converter.patch
0002-btrfsctl-add-snapshot-subvolume-destroy-ioctl.patch
0003-btrfsck-check-root-back-forward-references.patch
0004-Add-btrfs-map-logical-program-to-map-and-read-logica.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ btrfsprogs.spec ++++++
--- /var/tmp/diff_new_pack.1i19SW/_old 2010-03-09 16:55:36.000000000 +0100
+++ /var/tmp/diff_new_pack.1i19SW/_new 2010-03-09 16:55:36.000000000 +0100
@@ -20,13 +20,17 @@
Name: btrfsprogs
Url: http://oss.oracle.com/~mason/btrfs/
Version: 0.19
-Release: 5
+Release: 6
Summary: Btrfs File System Utilities
License: GNU General Public License (GPL)
Group: System/Filesystems
Supplements: filesystem(btrfs)
Source: http://ftp.kernel.org/pub/linux/kernel/people/mason/btrfs/btrfs-progs-%{version}.tar.bz2
Patch0: memleak-fix.diff
+Patch1: 0001-used-space-accounting-fix-for-the-converter.patch
+Patch2: 0002-btrfsctl-add-snapshot-subvolume-destroy-ioctl.patch
+Patch3: 0003-btrfsck-check-root-back-forward-references.patch
+Patch4: 0004-Add-btrfs-map-logical-program-to-map-and-read-logica.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libacl-devel libext2fs-devel libuuid-devel zlib-devel
@@ -37,6 +41,10 @@
%prep
%setup -q -n btrfs-progs-%{version}
%patch0
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
%build
make %{?jobs:-j%jobs} CFLAGS="%{optflags}" all convert
@@ -53,6 +61,7 @@
/sbin/btrfsck
/sbin/btrfsctl
/sbin/mkfs.btrfs
+/sbin/btrfs-map-logical
%_mandir/man8/btrfs-image.8.gz
%_mandir/man8/btrfs-show.8.gz
%_mandir/man8/btrfsck.8.gz
++++++ 0001-used-space-accounting-fix-for-the-converter.patch ++++++
From 4f89b6eb0718ade63152791db32794da78fbba70 Mon Sep 17 00:00:00 2001
From: Yan Zheng
Date: Fri, 12 Jun 2009 12:55:50 -0400
Subject: [PATCH 1/4] used space accounting fix for the converter
remove code that updates the total used space, since
btrfs_update_block_group does that work now.
Signed-off-by: Yan Zheng
Signed-off-by: Chris Mason
---
convert.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/convert.c b/convert.c
index d2c9efa..d037c98 100644
--- a/convert.c
+++ b/convert.c
@@ -370,7 +370,6 @@ static int record_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_extent_item *ei;
u32 blocksize = root->sectorsize;
u64 nbytes;
- u64 bytes_used;
if (disk_bytenr == 0) {
ret = btrfs_insert_file_extent(trans, root, objectid,
@@ -432,9 +431,6 @@ static int record_file_extent(struct btrfs_trans_handle *trans,
nbytes = btrfs_stack_inode_nbytes(inode) + num_bytes;
btrfs_set_stack_inode_nbytes(inode, nbytes);
- bytes_used = btrfs_root_used(&root->root_item);
- btrfs_set_root_used(&root->root_item, bytes_used + num_bytes);
-
btrfs_release_path(root, &path);
ins_key.objectid = disk_bytenr;
@@ -454,9 +450,6 @@ static int record_file_extent(struct btrfs_trans_handle *trans,
btrfs_mark_buffer_dirty(leaf);
- bytes_used = btrfs_super_bytes_used(&info->super_copy);
- btrfs_set_super_bytes_used(&info->super_copy, bytes_used +
- num_bytes);
ret = btrfs_update_block_group(trans, root, disk_bytenr,
num_bytes, 1, 0);
if (ret)
--
1.6.6.1
++++++ 0002-btrfsctl-add-snapshot-subvolume-destroy-ioctl.patch ++++++
From 45195b216d5da399aa71c11f111b2c0b45e54c82 Mon Sep 17 00:00:00 2001
From: Yan, Zheng
Date: Mon, 21 Sep 2009 16:03:57 -0400
Subject: [PATCH 2/4] btrfsctl: add snapshot/subvolume destroy ioctl
resend Aaron Straus's patch
Signed-off-by: Yan Zheng
Signed-off-by: Chris Mason
---
btrfsctl.c | 15 ++++++++++++++-
ioctl.h | 3 +++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/btrfsctl.c b/btrfsctl.c
index b323818..66c4e89 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -46,7 +46,7 @@ static inline int ioctl(int fd, int define, void *arg) { return 0; }
static void print_usage(void)
{
printf("usage: btrfsctl [ -d file|dir] [ -s snap_name subvol|tree ]\n");
- printf(" [-r size] [-A device] [-a] [-c]\n");
+ printf(" [-r size] [-A device] [-a] [-c] [-D dir .]\n");
printf("\t-d filename: defragments one file\n");
printf("\t-d directory: defragments the entire Btree\n");
printf("\t-s snap_name dir: creates a new snapshot of dir\n");
@@ -55,6 +55,7 @@ static void print_usage(void)
printf("\t-A device: scans the device file for a Btrfs filesystem\n");
printf("\t-a: scans all devices for Btrfs filesystems\n");
printf("\t-c: forces a single FS sync\n");
+ printf("\t-D: delete snapshot\n");
printf("%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -158,6 +159,18 @@ int main(int ac, char **av)
print_usage();
}
command = BTRFS_IOC_DEFRAG;
+ } else if (strcmp(av[i], "-D") == 0) {
+ if (i >= ac - 1) {
+ fprintf(stderr, "-D requires an arg\n");
+ print_usage();
+ }
+ command = BTRFS_IOC_SNAP_DESTROY;
+ name = av[i + 1];
+ len = strlen(name);
+ if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
+ fprintf(stderr, "-D size too long\n");
+ exit(1);
+ }
} else if (strcmp(av[i], "-A") == 0) {
if (i >= ac - 1) {
fprintf(stderr, "-A requires an arg\n");
diff --git a/ioctl.h b/ioctl.h
index a084f33..4410ac0 100644
--- a/ioctl.h
+++ b/ioctl.h
@@ -56,4 +56,7 @@ struct btrfs_ioctl_vol_args {
/* 13 is for CLONE_RANGE */
#define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \
struct btrfs_ioctl_vol_args)
+
+#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
+ struct btrfs_ioctl_vol_args)
#endif
--
1.6.6.1
++++++ 0003-btrfsck-check-root-back-forward-references.patch ++++++
++++ 700 lines (skipped)
++++++ 0004-Add-btrfs-map-logical-program-to-map-and-read-logica.patch ++++++
From ab8fb4c99516c186641bda1dbc0e788f68b4dc77 Mon Sep 17 00:00:00 2001
From: Chris Mason
Date: Thu, 12 Nov 2009 14:34:09 -0500
Subject: [PATCH 4/4] Add btrfs-map-logical program to map and read logical block numbers
This allows us to figure out which physical byte offset on which device
is the real location for a given logical block number. It can
optionally read the block in and save it to a file for debugging
analysis.
Signed-off-by: Chris Mason
---
Makefile | 6 +-
btrfs-map-logical.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 226 insertions(+), 1 deletions(-)
create mode 100644 btrfs-map-logical.c
diff --git a/Makefile b/Makefile
index 8097b5a..02f881e 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,8 @@ prefix ?= /usr/local
bindir = $(prefix)/bin
LIBS=-luuid
-progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck
+progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
+ btrfs-map-logical
# make C=1 to enable sparse
ifdef C
@@ -56,6 +57,9 @@ btrfs-debug-tree: $(objects) debug-tree.o
btrfstune: $(objects) btrfstune.o
gcc $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
+btrfs-map-logical: $(objects) btrfs-map-logical.o
+ gcc $(CFLAGS) -o btrfs-map-logical $(objects) btrfs-map-logical.o $(LDFLAGS) $(LIBS)
+
btrfs-image: $(objects) btrfs-image.o
gcc $(CFLAGS) -o btrfs-image $(objects) btrfs-image.o -lpthread -lz $(LDFLAGS) $(LIBS)
diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c
new file mode 100644
index 0000000..a109c6a
--- /dev/null
+++ b/btrfs-map-logical.c
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2009 Oracle. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#define _XOPEN_SOURCE 500
+#define _GNU_SOURCE 1
+#include
+#include
+#include
+#include
+#include
+#include "kerncompat.h"
+#include "ctree.h"
+#include "volumes.h"
+#include "disk-io.h"
+#include "print-tree.h"
+#include "transaction.h"
+#include "list.h"
+#include "version.h"
+
+/* we write the mirror info to stdout unless they are dumping the data
+ * to stdout
+ * */
+static FILE *info_file;
+
+struct extent_buffer *debug_read_block(struct btrfs_root *root, u64 bytenr,
+ u32 blocksize, int copy)
+{
+ int ret;
+ int dev_nr;
+ struct extent_buffer *eb;
+ u64 length;
+ struct btrfs_multi_bio *multi = NULL;
+ struct btrfs_device *device;
+ int num_copies;
+ int mirror_num = 1;
+
+ eb = btrfs_find_create_tree_block(root, bytenr, blocksize);
+ if (!eb)
+ return NULL;
+
+ dev_nr = 0;
+ length = blocksize;
+ while (1) {
+ ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
+ eb->start, &length, &multi, mirror_num);
+ BUG_ON(ret);
+ device = multi->stripes[0].dev;
+ eb->fd = device->fd;
+ device->total_ios++;
+ eb->dev_bytenr = multi->stripes[0].physical;
+
+ fprintf(info_file, "mirror %d logical %Lu physical %Lu "
+ "device %s\n", mirror_num, bytenr, eb->dev_bytenr,
+ device->name);
+ kfree(multi);
+
+ if (!copy || mirror_num == copy)
+ ret = read_extent_from_disk(eb);
+
+ num_copies = btrfs_num_copies(&root->fs_info->mapping_tree,
+ eb->start, eb->len);
+ if (num_copies == 1)
+ break;
+
+ mirror_num++;
+ if (mirror_num > num_copies)
+ break;
+ }
+ return eb;
+}
+
+static void print_usage(void)
+{
+ fprintf(stderr, "usage: btrfs-map-logical [options] mount_point\n");
+ fprintf(stderr, "\t-l Logical extent to map\n");
+ fprintf(stderr, "\t-c Copy of the extent to read (usually 1 or 2)\n");
+ fprintf(stderr, "\t-o Output file to hold the extent\n");
+ fprintf(stderr, "\t-s Number of bytes to read\n");
+ exit(1);
+}
+
+static struct option long_options[] = {
+ /* { "byte-count", 1, NULL, 'b' }, */
+ { "logical", 1, NULL, 'l' },
+ { "copy", 1, NULL, 'c' },
+ { "output", 1, NULL, 'c' },
+ { "bytes", 1, NULL, 'b' },
+ { 0, 0, 0, 0}
+};
+
+int main(int ac, char **av)
+{
+ struct cache_tree root_cache;
+ struct btrfs_root *root;
+ struct extent_buffer *eb;
+ char *dev;
+ char *output_file = NULL;
+ u64 logical = 0;
+ int ret = 0;
+ int option_index = 0;
+ int copy = 0;
+ u64 bytes = 0;
+ int out_fd = 0;
+ int err;
+
+ while(1) {
+ int c;
+ c = getopt_long(ac, av, "l:c:o:b:", long_options,
+ &option_index);
+ if (c < 0)
+ break;
+ switch(c) {
+ case 'l':
+ logical = atoll(optarg);
+ if (logical == 0) {
+ fprintf(stderr,
+ "invalid extent number\n");
+ print_usage();
+ }
+ break;
+ case 'c':
+ copy = atoi(optarg);
+ if (copy == 0) {
+ fprintf(stderr,
+ "invalid copy number\n");
+ print_usage();
+ }
+ break;
+ case 'b':
+ bytes = atoll(optarg);
+ if (bytes == 0) {
+ fprintf(stderr,
+ "invalid byte count\n");
+ print_usage();
+ }
+ break;
+ case 'o':
+ output_file = strdup(optarg);
+ break;
+ default:
+ print_usage();
+ }
+ }
+ ac = ac - optind;
+ if (ac == 0)
+ print_usage();
+ if (logical == 0)
+ print_usage();
+ if (copy < 0)
+ print_usage();
+
+ dev = av[optind];
+
+ radix_tree_init();
+ cache_tree_init(&root_cache);
+
+ root = open_ctree(dev, 0, 0);
+ if (!root) {
+ fprintf(stderr, "Open ctree failed\n");
+ exit(1);
+ }
+
+ if (output_file) {
+ if (strcmp(output_file, "-") == 0) {
+ out_fd = 1;
+ info_file = stderr;
+ } else {
+ out_fd = open(output_file, O_RDWR | O_CREAT, 0600);
+ if (out_fd < 0)
+ goto close;
+ err = ftruncate(out_fd, 0);
+ if (err) {
+ close(out_fd);
+ goto close;
+ }
+ info_file = stdout;
+ }
+ }
+
+ if (bytes == 0)
+ bytes = root->sectorsize;
+
+ bytes = (bytes + root->sectorsize - 1) / root->sectorsize;
+ bytes *= root->sectorsize;
+
+ while (bytes > 0) {
+ eb = debug_read_block(root, logical, root->sectorsize, copy);
+ if (eb && output_file) {
+ err = write(out_fd, eb->data, eb->len);
+ if (err < 0 || err != eb->len) {
+ fprintf(stderr, "output file write failed\n");
+ goto out_close_fd;
+ }
+ }
+ free_extent_buffer(eb);
+ logical += root->sectorsize;
+ bytes -= root->sectorsize;
+ }
+
+out_close_fd:
+ if (output_file && out_fd != 1)
+ close(out_fd);
+close:
+ close_ctree(root);
+ return ret;
+}
--
1.6.6.1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org