Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
67b17bcf21 | ||
|
6bdb22ac38 | ||
|
d17ecce819 | ||
|
b93957c4d2 | ||
|
194d74fec7 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,3 +15,6 @@ repair
|
|||||||
restore
|
restore
|
||||||
/btrfs-progs-0.19.20120817git043a639.tar.bz2
|
/btrfs-progs-0.19.20120817git043a639.tar.bz2
|
||||||
/btrfs-progs-0.20.rc1.20121017git91d9eec.tar.bz2
|
/btrfs-progs-0.20.rc1.20121017git91d9eec.tar.bz2
|
||||||
|
/btrfs-progs-v3.12.tar.bz2
|
||||||
|
/btrfs-progs-v3.14.tar.xz
|
||||||
|
/btrfs-progs-v3.14.1.tar.xz
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
From 01077c81987011d8a50999824f96032c10b2733b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Josef Bacik <jbacik@fusionio.com>
|
|
||||||
Date: Thu, 21 Jun 2012 16:02:10 -0400
|
|
||||||
Subject: [PATCH 1/3] Btrfs-progs: add btrfs device ready command
|
|
||||||
|
|
||||||
This command will be used by things like dracut that wish to know very
|
|
||||||
simply if all of the devices have been added to the kernel cache yet for the
|
|
||||||
device to be fully mounted. This keeps initrd's from constantly having to
|
|
||||||
try to mount the file system until it succeeds every time a device is added
|
|
||||||
to the system. Thanks,
|
|
||||||
|
|
||||||
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
|
|
||||||
---
|
|
||||||
cmds-device.c | 35 +++++++++++++++++++++++++++++++++++
|
|
||||||
ioctl.h | 2 ++
|
|
||||||
2 files changed, 37 insertions(+), 0 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmds-device.c b/cmds-device.c
|
|
||||||
index 771856b..b24e2a3 100644
|
|
||||||
--- a/cmds-device.c
|
|
||||||
+++ b/cmds-device.c
|
|
||||||
@@ -249,11 +249,46 @@ static int cmd_scan_dev(int argc, char **argv)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static const char * const cmd_ready_dev_usage[] = {
|
|
||||||
+ "btrfs device ready <device>",
|
|
||||||
+ "Check device to see if it has all of it's devices in cache for mounting",
|
|
||||||
+ NULL
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int cmd_ready_dev(int argc, char **argv)
|
|
||||||
+{
|
|
||||||
+ struct btrfs_ioctl_vol_args args;
|
|
||||||
+ int fd;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ if (check_argc_min(argc, 2))
|
|
||||||
+ usage(cmd_ready_dev_usage);
|
|
||||||
+
|
|
||||||
+ fd = open("/dev/btrfs-control", O_RDWR);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ perror("failed to open /dev/btrfs-control");
|
|
||||||
+ return 10;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ strncpy(args.name, argv[argc - 1], BTRFS_PATH_NAME_MAX);
|
|
||||||
+ ret = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ fprintf(stderr, "ERROR: unable to determine if the device '%s'"
|
|
||||||
+ " is ready for mounting - %s\n", argv[argc - 1],
|
|
||||||
+ strerror(errno));
|
|
||||||
+ ret = 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ close(fd);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
const struct cmd_group device_cmd_group = {
|
|
||||||
device_cmd_group_usage, NULL, {
|
|
||||||
{ "add", cmd_add_dev, cmd_add_dev_usage, NULL, 0 },
|
|
||||||
{ "delete", cmd_rm_dev, cmd_rm_dev_usage, NULL, 0 },
|
|
||||||
{ "scan", cmd_scan_dev, cmd_scan_dev_usage, NULL, 0 },
|
|
||||||
+ { "ready", cmd_ready_dev, cmd_ready_dev_usage, NULL, 0 },
|
|
||||||
{ 0, 0, 0, 0, 0 }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
diff --git a/ioctl.h b/ioctl.h
|
|
||||||
index d6f3d07..30220ad 100644
|
|
||||||
--- a/ioctl.h
|
|
||||||
+++ b/ioctl.h
|
|
||||||
@@ -365,6 +365,8 @@ struct btrfs_ioctl_clone_range_args {
|
|
||||||
struct btrfs_ioctl_ino_path_args)
|
|
||||||
#define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
|
|
||||||
struct btrfs_ioctl_ino_path_args)
|
|
||||||
+#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
|
|
||||||
+ struct btrfs_ioctl_vol_args)
|
|
||||||
|
|
||||||
#define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
|
|
||||||
struct btrfs_ioctl_received_subvol_args)
|
|
||||||
--
|
|
||||||
1.7.7.6
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
|||||||
From fe4e9b20d9ffffbb6aade4083caa71d65f16230a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Josef Bacik <jbacik@fusionio.com>
|
|
||||||
Date: Fri, 20 Jul 2012 11:09:43 -0400
|
|
||||||
Subject: [PATCH] Btrfs-progs: detect if the disk we are formatting is a ssd
|
|
||||||
|
|
||||||
SSD's do not gain anything by having metadata DUP turned on. The underlying
|
|
||||||
file system that is a part of all SSD's could easily map duplicate metadat
|
|
||||||
blocks into the same erase block which effectively eliminates the benefit of
|
|
||||||
duplicating the metadata on disk. So detect if we are formatting a single
|
|
||||||
SSD drive and if we are do not use DUP. Thanks,
|
|
||||||
|
|
||||||
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
|
|
||||||
---
|
|
||||||
Makefile | 2 +-
|
|
||||||
man/mkfs.btrfs.8.in | 5 +++-
|
|
||||||
mkfs.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++--
|
|
||||||
3 files changed, 65 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 4894903..c7fd97d 100644
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -67,7 +67,7 @@ btrfsck: $(objects) btrfsck.o
|
|
||||||
$(CC) $(CFLAGS) -o btrfsck btrfsck.o $(objects) $(LDFLAGS) $(LIBS)
|
|
||||||
|
|
||||||
mkfs.btrfs: $(objects) mkfs.o
|
|
||||||
- $(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
|
|
||||||
+ $(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS) -lblkid
|
|
||||||
|
|
||||||
btrfs-debug-tree: $(objects) debug-tree.o
|
|
||||||
$(CC) $(CFLAGS) -o btrfs-debug-tree $(objects) debug-tree.o $(LDFLAGS) $(LIBS)
|
|
||||||
diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in
|
|
||||||
index 72025ed..b7bcc1b 100644
|
|
||||||
--- a/man/mkfs.btrfs.8.in
|
|
||||||
+++ b/man/mkfs.btrfs.8.in
|
|
||||||
@@ -47,7 +47,10 @@ Specify a label for the filesystem.
|
|
||||||
.TP
|
|
||||||
\fB\-m\fR, \fB\-\-metadata \fIprofile\fR
|
|
||||||
Specify how metadata must be spanned across the devices specified. Valid
|
|
||||||
-values are raid0, raid1, raid10 or single.
|
|
||||||
+values are raid0, raid1, raid10, single or dup. Single device will have dup
|
|
||||||
+set by default except in the case of SSDs which will default to single. This is
|
|
||||||
+because SSDs can remap blocks internally so duplicate blocks could end up in the
|
|
||||||
+same erase block which negates the benefits of doing metadata duplication.
|
|
||||||
.TP
|
|
||||||
\fB\-M\fR, \fB\-\-mixed\fR
|
|
||||||
Mix data and metadata chunks together for more efficient space
|
|
||||||
diff --git a/mkfs.c b/mkfs.c
|
|
||||||
index 47f0c9c..72f10fa 100644
|
|
||||||
--- a/mkfs.c
|
|
||||||
+++ b/mkfs.c
|
|
||||||
@@ -37,6 +37,7 @@
|
|
||||||
#include <linux/fs.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <attr/xattr.h>
|
|
||||||
+#include <blkid/blkid.h>
|
|
||||||
#include "kerncompat.h"
|
|
||||||
#include "ctree.h"
|
|
||||||
#include "disk-io.h"
|
|
||||||
@@ -234,7 +235,7 @@ static int create_one_raid_group(struct btrfs_trans_handle *trans,
|
|
||||||
static int create_raid_groups(struct btrfs_trans_handle *trans,
|
|
||||||
struct btrfs_root *root, u64 data_profile,
|
|
||||||
int data_profile_opt, u64 metadata_profile,
|
|
||||||
- int metadata_profile_opt, int mixed)
|
|
||||||
+ int metadata_profile_opt, int mixed, int ssd)
|
|
||||||
{
|
|
||||||
u64 num_devices = btrfs_super_num_devices(&root->fs_info->super_copy);
|
|
||||||
u64 allowed;
|
|
||||||
@@ -245,8 +246,12 @@ static int create_raid_groups(struct btrfs_trans_handle *trans,
|
|
||||||
* For mixed groups defaults are single/single.
|
|
||||||
*/
|
|
||||||
if (!metadata_profile_opt && !mixed) {
|
|
||||||
+ if (num_devices == 1 && ssd)
|
|
||||||
+ printf("Detected a SSD, turning off metadata "
|
|
||||||
+ "duplication. Mkfs with -m dup if you want to "
|
|
||||||
+ "force metadata duplication.\n");
|
|
||||||
metadata_profile = (num_devices > 1) ?
|
|
||||||
- BTRFS_BLOCK_GROUP_RAID1 : BTRFS_BLOCK_GROUP_DUP;
|
|
||||||
+ BTRFS_BLOCK_GROUP_RAID1 : (ssd) ? 0: BTRFS_BLOCK_GROUP_DUP;
|
|
||||||
}
|
|
||||||
if (!data_profile_opt && !mixed) {
|
|
||||||
data_profile = (num_devices > 1) ?
|
|
||||||
@@ -1222,6 +1227,54 @@ static int check_leaf_or_node_size(u32 size, u32 sectorsize)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int is_ssd(const char *file)
|
|
||||||
+{
|
|
||||||
+ char *devname;
|
|
||||||
+ blkid_probe probe;
|
|
||||||
+ char *dev;
|
|
||||||
+ char path[PATH_MAX];
|
|
||||||
+ dev_t disk;
|
|
||||||
+ int fd;
|
|
||||||
+ char rotational;
|
|
||||||
+
|
|
||||||
+ probe = blkid_new_probe_from_filename(file);
|
|
||||||
+ if (!probe)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * We want to use blkid_devno_to_wholedisk() but it's broken for some
|
|
||||||
+ * reason on F17 at least so we'll do this trickery
|
|
||||||
+ */
|
|
||||||
+ disk = blkid_probe_get_wholedisk_devno(probe);
|
|
||||||
+ if (!disk)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ devname = blkid_devno_to_devname(disk);
|
|
||||||
+ if (!devname)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ dev = strrchr(devname, '/');
|
|
||||||
+ dev++;
|
|
||||||
+
|
|
||||||
+ snprintf(path, PATH_MAX, "/sys/block/%s/queue/rotational", dev);
|
|
||||||
+
|
|
||||||
+ free(devname);
|
|
||||||
+ blkid_free_probe(probe);
|
|
||||||
+
|
|
||||||
+ fd = open(path, O_RDONLY);
|
|
||||||
+ if (fd < 0) {
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (read(fd, &rotational, sizeof(char)) < sizeof(char)) {
|
|
||||||
+ close(fd);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ close(fd);
|
|
||||||
+
|
|
||||||
+ return !atoi((const char *)&rotational);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int main(int ac, char **av)
|
|
||||||
{
|
|
||||||
char *file;
|
|
||||||
@@ -1248,6 +1301,7 @@ int main(int ac, char **av)
|
|
||||||
int data_profile_opt = 0;
|
|
||||||
int metadata_profile_opt = 0;
|
|
||||||
int nodiscard = 0;
|
|
||||||
+ int ssd = 0;
|
|
||||||
|
|
||||||
char *source_dir = NULL;
|
|
||||||
int source_dir_set = 0;
|
|
||||||
@@ -1367,6 +1421,9 @@ int main(int ac, char **av)
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ ssd = is_ssd(file);
|
|
||||||
+
|
|
||||||
if (mixed) {
|
|
||||||
if (metadata_profile != data_profile) {
|
|
||||||
fprintf(stderr, "With mixed block groups data and metadata "
|
|
||||||
@@ -1452,7 +1509,7 @@ raid_groups:
|
|
||||||
if (!source_dir_set) {
|
|
||||||
ret = create_raid_groups(trans, root, data_profile,
|
|
||||||
data_profile_opt, metadata_profile,
|
|
||||||
- metadata_profile_opt, mixed);
|
|
||||||
+ metadata_profile_opt, mixed, ssd);
|
|
||||||
BUG_ON(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
1.7.7.6
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 33cbabf480ea811ddaef1b5f97603f4c7df7b240 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Josef Bacik <josef@redhat.com>
|
|
||||||
Date: Wed, 25 Apr 2012 14:25:24 -0400
|
|
||||||
Subject: [PATCH] Btrfs-progs: make btrfs filesystem show <uuid> actually work
|
|
||||||
|
|
||||||
The btrfs filesystem show command is only actually searching for labels,
|
|
||||||
it's not searching for UUID's at all. This patch fixes that problem.
|
|
||||||
Thanks,
|
|
||||||
|
|
||||||
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
||||||
---
|
|
||||||
cmds-filesystem.c | 7 +++++++
|
|
||||||
1 files changed, 7 insertions(+), 0 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
|
|
||||||
index 1f53d1c..ff98a77 100644
|
|
||||||
--- a/cmds-filesystem.c
|
|
||||||
+++ b/cmds-filesystem.c
|
|
||||||
@@ -155,8 +155,15 @@ static int cmd_df(int argc, char **argv)
|
|
||||||
|
|
||||||
static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search)
|
|
||||||
{
|
|
||||||
+ char uuidbuf[37];
|
|
||||||
struct list_head *cur;
|
|
||||||
struct btrfs_device *device;
|
|
||||||
+ int search_len = strlen(search);
|
|
||||||
+
|
|
||||||
+ search_len = min(search_len, 37);
|
|
||||||
+ uuid_unparse(fs_devices->fsid, uuidbuf);
|
|
||||||
+ if (!strncmp(uuidbuf, search, search_len))
|
|
||||||
+ return 1;
|
|
||||||
|
|
||||||
list_for_each(cur, &fs_devices->devices) {
|
|
||||||
device = list_entry(cur, struct btrfs_device, dev_list);
|
|
||||||
--
|
|
||||||
1.7.7.6
|
|
||||||
|
|
@ -2,15 +2,6 @@ diff --git a/utils.c b/utils.c
|
|||||||
index a5ffb62..f6686c6 100644
|
index a5ffb62..f6686c6 100644
|
||||||
--- a/utils.c
|
--- a/utils.c
|
||||||
+++ b/utils.c
|
+++ b/utils.c
|
||||||
@@ -476,7 +476,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
|
|
||||||
u64 num_devs;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
- device = kmalloc(sizeof(*device), GFP_NOFS);
|
|
||||||
+ device = kzalloc(sizeof(*device), GFP_NOFS);
|
|
||||||
if (!device)
|
|
||||||
return -ENOMEM;
|
|
||||||
buf = kmalloc(sectorsize, GFP_NOFS);
|
|
||||||
@@ -502,6 +502,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
|
@@ -502,6 +502,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
|
||||||
device->bytes_used = 0;
|
device->bytes_used = 0;
|
||||||
device->total_ios = 0;
|
device->total_ios = 0;
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
diff -up btrfs-progs-0.19/Makefile.build btrfs-progs-0.19/Makefile
|
|
||||||
--- btrfs-progs-0.19/Makefile.build 2011-08-05 14:06:29.871749619 -0400
|
|
||||||
+++ btrfs-progs-0.19/Makefile 2011-08-05 14:06:45.419727708 -0400
|
|
||||||
@@ -17,8 +17,7 @@ bindir = $(prefix)/bin
|
|
||||||
LIBS=-luuid
|
|
||||||
|
|
||||||
progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
|
|
||||||
- btrfs \
|
|
||||||
- btrfs-map-logical
|
|
||||||
+ btrfs btrfs-map-logical btrfstune btrfs-image btrfs-zero-log
|
|
||||||
|
|
||||||
# make C=1 to enable sparse
|
|
||||||
ifdef C
|
|
@ -1,34 +0,0 @@
|
|||||||
diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c.patch2 btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c
|
|
||||||
--- btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c.patch2 2012-10-04 20:35:31.000000000 -0400
|
|
||||||
+++ btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c 2012-10-17 13:45:30.172638798 -0400
|
|
||||||
@@ -22,7 +22,9 @@
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
+#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
#include "kerncompat.h"
|
|
||||||
#include "ctree.h"
|
|
||||||
diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c.patch2 btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c
|
|
||||||
--- btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c.patch2 2012-10-17 13:45:30.167638835 -0400
|
|
||||||
+++ btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c 2012-10-17 13:46:41.444084426 -0400
|
|
||||||
@@ -1228,7 +1228,7 @@ int main(int ac, char **av)
|
|
||||||
u64 alloc_start = 0;
|
|
||||||
u64 metadata_profile = 0;
|
|
||||||
u64 data_profile = 0;
|
|
||||||
- u32 leafsize = getpagesize();
|
|
||||||
+ u32 leafsize = sysconf(_SC_PAGESIZE);
|
|
||||||
u32 sectorsize = 4096;
|
|
||||||
u32 nodesize = leafsize;
|
|
||||||
u32 stripesize = 4096;
|
|
||||||
@@ -1304,7 +1304,7 @@ int main(int ac, char **av)
|
|
||||||
print_usage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- sectorsize = max(sectorsize, (u32)getpagesize());
|
|
||||||
+ sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
|
|
||||||
if (check_leaf_or_node_size(leafsize, sectorsize))
|
|
||||||
exit(1);
|
|
||||||
if (check_leaf_or_node_size(nodesize, sectorsize))
|
|
@ -1,55 +0,0 @@
|
|||||||
From 6eba9002956ac40db87d42fb653a0524dc568810 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Goffredo Baroncelli <kreijack@inwind.it>
|
|
||||||
Date: Tue, 4 Sep 2012 19:59:26 +0200
|
|
||||||
Subject: [PATCH 1/1] Correct un-initialized fsid variable
|
|
||||||
|
|
||||||
---
|
|
||||||
disk-io.c | 20 ++++++++++++++++----
|
|
||||||
1 files changed, 16 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/disk-io.c b/disk-io.c
|
|
||||||
index b21a87f..0395205 100644
|
|
||||||
--- a/disk-io.c
|
|
||||||
+++ b/disk-io.c
|
|
||||||
@@ -910,6 +910,7 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
|
|
||||||
int btrfs_read_dev_super(int fd, struct btrfs_super_block *sb, u64 sb_bytenr)
|
|
||||||
{
|
|
||||||
u8 fsid[BTRFS_FSID_SIZE];
|
|
||||||
+ int fsid_is_initialized = 0;
|
|
||||||
struct btrfs_super_block buf;
|
|
||||||
int i;
|
|
||||||
int ret;
|
|
||||||
@@ -936,15 +937,26 @@ int btrfs_read_dev_super(int fd, struct btrfs_super_block *sb, u64 sb_bytenr)
|
|
||||||
if (ret < sizeof(buf))
|
|
||||||
break;
|
|
||||||
|
|
||||||
- if (btrfs_super_bytenr(&buf) != bytenr ||
|
|
||||||
- strncmp((char *)(&buf.magic), BTRFS_MAGIC,
|
|
||||||
+ if (btrfs_super_bytenr(&buf) != bytenr )
|
|
||||||
+ continue;
|
|
||||||
+ /* if magic is NULL, the device was removed */
|
|
||||||
+ if (buf.magic == 0 && i == 0)
|
|
||||||
+ return -1;
|
|
||||||
+ if (strncmp((char *)(&buf.magic), BTRFS_MAGIC,
|
|
||||||
sizeof(buf.magic)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- if (i == 0)
|
|
||||||
+ if (!fsid_is_initialized) {
|
|
||||||
memcpy(fsid, buf.fsid, sizeof(fsid));
|
|
||||||
- else if (memcmp(fsid, buf.fsid, sizeof(fsid)))
|
|
||||||
+ fsid_is_initialized = 1;
|
|
||||||
+ } else if (memcmp(fsid, buf.fsid, sizeof(fsid))) {
|
|
||||||
+ /*
|
|
||||||
+ * the superblocks (the original one and
|
|
||||||
+ * its backups) contain data of different
|
|
||||||
+ * filesystems -> the super cannot be trusted
|
|
||||||
+ */
|
|
||||||
continue;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (btrfs_super_generation(&buf) > transid) {
|
|
||||||
memcpy(sb, &buf, sizeof(*sb));
|
|
||||||
--
|
|
||||||
1.7.7.6
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
diff -up btrfs-progs-0.19/mkfs.c.orig btrfs-progs-0.19/mkfs.c
|
|
||||||
--- btrfs-progs-0.19/mkfs.c.orig 2012-04-11 10:38:26.825973948 -0400
|
|
||||||
+++ btrfs-progs-0.19/mkfs.c 2012-04-11 10:39:46.031360540 -0400
|
|
||||||
@@ -372,7 +372,6 @@ static u64 parse_profile(char *s)
|
|
||||||
|
|
||||||
static char *parse_label(char *input)
|
|
||||||
{
|
|
||||||
- int i;
|
|
||||||
int len = strlen(input);
|
|
||||||
|
|
||||||
if (len >= BTRFS_LABEL_SIZE) {
|
|
||||||
@@ -380,12 +379,6 @@ static char *parse_label(char *input)
|
|
||||||
BTRFS_LABEL_SIZE - 1);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
- for (i = 0; i < len; i++) {
|
|
||||||
- if (input[i] == '/' || input[i] == '\\') {
|
|
||||||
- fprintf(stderr, "invalid label %s\n", input);
|
|
||||||
- exit(1);
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
return strdup(input);
|
|
||||||
}
|
|
||||||
|
|
123
btrfs-progs.spec
123
btrfs-progs.spec
@ -1,73 +1,130 @@
|
|||||||
Name: btrfs-progs
|
Name: btrfs-progs
|
||||||
Version: 0.20.rc1.20121017git91d9eec
|
Version: 3.14.1
|
||||||
Release: 2%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Userspace programs for btrfs
|
Summary: Userspace programs for btrfs
|
||||||
|
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: http://btrfs.wiki.kernel.org/index.php/Main_Page
|
URL: http://btrfs.wiki.kernel.org/index.php/Main_Page
|
||||||
Source0: %{name}-%{version}.tar.bz2
|
Source0: https://www.kernel.org/pub/linux/kernel/people/mason/%{name}/%{name}-v%{version}.tar.xz
|
||||||
Patch0: btrfs-progs-fix-labels.patch
|
|
||||||
Patch1: btrfs-progs-valgrind.patch
|
|
||||||
Patch2: btrfs-progs-build-fixes.patch
|
|
||||||
Patch3: Btrfs-progs-add-btrfs-device-ready-command.patch
|
|
||||||
Patch4: Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch
|
|
||||||
Patch5: btrfs-init-dev-list.patch
|
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
# Valgrind patch no longer applied, but kept for posterity
|
||||||
|
# Still must reverse-engineer fixes in there and get upstream
|
||||||
|
Patch0: btrfs-progs-valgrind.patch
|
||||||
|
Patch1: btrfs-init-dev-list.patch
|
||||||
|
|
||||||
BuildRequires: e2fsprogs-devel, libuuid-devel, zlib-devel, libacl-devel, libblkid-devel
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
|
BuildRequires: e2fsprogs-devel, libuuid-devel, zlib-devel
|
||||||
|
BuildRequires: libacl-devel, libblkid-devel, lzo-devel
|
||||||
|
|
||||||
%define _root_sbindir /sbin
|
%define _root_sbindir /sbin
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The btrfs-progs package provides all the userpsace programs needed to create,
|
The btrfs-progs package provides all the userspace programs needed to create,
|
||||||
check, modify and correct any inconsistencies in the btrfs filesystem.
|
check, modify and correct any inconsistencies in the btrfs filesystem.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: btrfs filesystem-specific libraries and headers
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: btrfs-progs = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
btrfs-progs-devel contains the libraries and header files needed to
|
||||||
|
develop btrfs filesystem-specific programs.
|
||||||
|
|
||||||
|
You should install btrfs-progs-devel if you want to develop
|
||||||
|
btrfs filesystem-specific programs.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q -n %{name}-v%{version}
|
||||||
%patch0 -p1
|
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
|
make CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
make mandir=%{_mandir} bindir=%{_sbindir} install DESTDIR=$RPM_BUILD_ROOT
|
make mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir}/btrfs install DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
# Nuke the static lib
|
||||||
|
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.a
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%doc COPYING INSTALL
|
%doc COPYING
|
||||||
%{_sbindir}/btrfsctl
|
%{_libdir}/libbtrfs.so.0*
|
||||||
%{_sbindir}/btrfsck
|
%{_sbindir}/btrfsck
|
||||||
|
%{_sbindir}/fsck.btrfs
|
||||||
%{_sbindir}/mkfs.btrfs
|
%{_sbindir}/mkfs.btrfs
|
||||||
%{_sbindir}/btrfs-debug-tree
|
%{_sbindir}/btrfs-debug-tree
|
||||||
%{_sbindir}/btrfs-image
|
%{_sbindir}/btrfs-image
|
||||||
%{_sbindir}/btrfs-show
|
|
||||||
%{_sbindir}/btrfs-vol
|
|
||||||
%{_sbindir}/btrfs-convert
|
%{_sbindir}/btrfs-convert
|
||||||
%{_sbindir}/btrfstune
|
%{_sbindir}/btrfstune
|
||||||
%{_sbindir}/btrfs
|
%{_sbindir}/btrfs
|
||||||
%{_sbindir}/btrfs-map-logical
|
%{_sbindir}/btrfs-map-logical
|
||||||
%{_sbindir}/btrfs-zero-log
|
%{_sbindir}/btrfs-zero-log
|
||||||
%{_sbindir}/btrfs-restore
|
|
||||||
%{_sbindir}/btrfs-find-root
|
%{_sbindir}/btrfs-find-root
|
||||||
|
%{_sbindir}/btrfs-show-super
|
||||||
%{_mandir}/man8/btrfs-image.8.gz
|
%{_mandir}/man8/btrfs-image.8.gz
|
||||||
%{_mandir}/man8/btrfs-show.8.gz
|
|
||||||
%{_mandir}/man8/btrfsck.8.gz
|
%{_mandir}/man8/btrfsck.8.gz
|
||||||
%{_mandir}/man8/btrfsctl.8.gz
|
%{_mandir}/man8/fsck.btrfs.8.gz
|
||||||
%{_mandir}/man8/mkfs.btrfs.8.gz
|
%{_mandir}/man8/mkfs.btrfs.8.gz
|
||||||
%{_mandir}/man8/btrfs.8.gz
|
%{_mandir}/man8/btrfs.8.gz
|
||||||
|
%{_mandir}/man8/btrfs-convert.8.gz
|
||||||
|
%{_mandir}/man8/btrfs-debug-tree.8.gz
|
||||||
|
%{_mandir}/man8/btrfs-find-root.8.gz
|
||||||
|
%{_mandir}/man8/btrfs-map-logical.8.gz
|
||||||
|
%{_mandir}/man8/btrfs-show-super.8.gz
|
||||||
|
%{_mandir}/man8/btrfs-zero-log.8.gz
|
||||||
|
%{_mandir}/man8/btrfstune.8.gz
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%{_includedir}/*
|
||||||
|
%{_libdir}/libbtrfs.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 22 2014 Eric Sandeen <sandeen@redhat.com> 3.14.1-1
|
||||||
|
- New upstream release
|
||||||
|
|
||||||
|
* Wed Apr 16 2014 Eric Sandeen <sandeen@redhat.com> 3.14-1
|
||||||
|
- New upstream release
|
||||||
|
|
||||||
|
* Mon Jan 20 2014 Eric Sandeen <sandeen@redhat.com> 3.12-2
|
||||||
|
- Add proper Source0 URL, switch to .xz
|
||||||
|
|
||||||
|
* Mon Nov 25 2013 Eric Sandeen <sandeen@redhat.com> 3.12-1
|
||||||
|
- It's a new upstream release!
|
||||||
|
|
||||||
|
* Thu Nov 14 2013 Eric Sandeen <sandeen@redhat.com> 0.20.rc1.20131114git9f0c53f-1
|
||||||
|
- New upstream snapshot
|
||||||
|
|
||||||
|
* Tue Sep 17 2013 Eric Sandeen <sandeen@redhat.com> 0.20.rc1.20130917git194aa4a-1
|
||||||
|
- New upstream snapshot
|
||||||
|
- Deprecated btrfsctl, btrfs-show, and btrfs-vol; still available in btrfs cmd
|
||||||
|
|
||||||
|
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20.rc1.20130501git7854c8b-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon May 13 2013 Richard W.M. Jones <rjones@redhat.com> 0.20.rc1.20130501git7854c8b-3
|
||||||
|
- Add accepted upstream patch to fix SONAME libbtrfs.so -> libbtrfs.so.0
|
||||||
|
|
||||||
|
* Thu May 02 2013 Eric Sandeen <sandeen@redhat.com> 0.20.rc1.20130501git7854c8b-2
|
||||||
|
- Fix subpackage brokenness
|
||||||
|
|
||||||
|
* Wed May 01 2013 Eric Sandeen <sandeen@redhat.com> 0.20.rc1.20130501git7854c8b-1
|
||||||
|
- New upstream snapshot
|
||||||
|
- btrfs-progs-devel subpackage
|
||||||
|
|
||||||
|
* Fri Mar 08 2013 Eric Sandeen <sandeen@redhat.com> 0.20.rc1.20130308git704a08c-1
|
||||||
|
- New upstream snapshot
|
||||||
|
- btrfs-restore is now a command in the btrfs utility
|
||||||
|
|
||||||
|
* Wed Feb 13 2013 Richard W.M. Jones <rjones@redhat.com> 0.20.rc1.20121017git91d9eec-3
|
||||||
|
- Include upstream patch to clear caches as a partial fix for RHBZ#863978.
|
||||||
|
|
||||||
* Thu Nov 1 2012 Josef Bacik <josef@toxicpanda.com> 0.20.rc1.20121017git91d9eec-2
|
* Thu Nov 1 2012 Josef Bacik <josef@toxicpanda.com> 0.20.rc1.20121017git91d9eec-2
|
||||||
- fix a bug when mkfs'ing a file (rhbz# 871778)
|
- fix a bug when mkfs'ing a file (rhbz# 871778)
|
||||||
|
|
||||||
@ -169,7 +226,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
* Sat Jan 10 2009 Marek Mahut <mmahut@fedoraproject.org> 0.16-1
|
* Sat Jan 10 2009 Marek Mahut <mmahut@fedoraproject.org> 0.16-1
|
||||||
- Upstream release 0.16
|
- Upstream release 0.16
|
||||||
|
|
||||||
* Mon Jun 25 2008 Josef Bacik <josef@toxicpanda.com> 0.15-4
|
* Wed Jun 25 2008 Josef Bacik <josef@toxicpanda.com> 0.15-4
|
||||||
-use fedoras normal CFLAGS
|
-use fedoras normal CFLAGS
|
||||||
|
|
||||||
* Mon Jun 23 2008 Josef Bacik <josef@toxicpanda.com> 0.15-3
|
* Mon Jun 23 2008 Josef Bacik <josef@toxicpanda.com> 0.15-3
|
||||||
|
Loading…
Reference in New Issue
Block a user