diff options
author | Joe Peterson <lavajoe@gentoo.org> | 2008-05-24 19:50:06 +0000 |
---|---|---|
committer | Joe Peterson <lavajoe@gentoo.org> | 2008-05-24 19:50:06 +0000 |
commit | 89f0d54f9066fb3de238a664c8937e6e1be39275 (patch) | |
tree | 8cd4e9e9f939709288880e7b022222b7b1736ed6 /sys-fs | |
parent | Stable on ppc wrt bug 223443 (diff) | |
download | historical-89f0d54f9066fb3de238a664c8937e6e1be39275.tar.gz historical-89f0d54f9066fb3de238a664c8937e6e1be39275.tar.bz2 historical-89f0d54f9066fb3de238a664c8937e6e1be39275.zip |
New package
Package-Manager: portage-2.1.4.4
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/btrfs-progs/ChangeLog | 11 | ||||
-rw-r--r-- | sys-fs/btrfs-progs/Manifest | 5 | ||||
-rw-r--r-- | sys-fs/btrfs-progs/btrfs-progs-0.14.ebuild | 36 | ||||
-rw-r--r-- | sys-fs/btrfs-progs/files/btrfs-progs-0.14-hotfix.patch | 268 | ||||
-rw-r--r-- | sys-fs/btrfs-progs/metadata.xml | 8 | ||||
-rw-r--r-- | sys-fs/btrfs/ChangeLog | 10 | ||||
-rw-r--r-- | sys-fs/btrfs/Manifest | 5 | ||||
-rw-r--r-- | sys-fs/btrfs/btrfs-0.14.ebuild | 58 | ||||
-rw-r--r-- | sys-fs/btrfs/files/btrfs-0.14-hotfix.patch | 465 | ||||
-rw-r--r-- | sys-fs/btrfs/metadata.xml | 8 |
10 files changed, 874 insertions, 0 deletions
diff --git a/sys-fs/btrfs-progs/ChangeLog b/sys-fs/btrfs-progs/ChangeLog new file mode 100644 index 000000000000..e86d63340b1c --- /dev/null +++ b/sys-fs/btrfs-progs/ChangeLog @@ -0,0 +1,11 @@ +# ChangeLog for sys-fs/btrfs-progs +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/btrfs-progs/ChangeLog,v 1.1 2008/05/24 19:50:05 lavajoe Exp $ + +*btrfs-progs-0.14 (24 May 2008) + + 24 May 2008; Joe Peterson <lavajoe@gentoo.org> + +files/btrfs-progs-0.14-hotfix.patch, +metadata.xml, + +btrfs-progs-0.14.ebuild: + New package: Btrfs utilities + diff --git a/sys-fs/btrfs-progs/Manifest b/sys-fs/btrfs-progs/Manifest new file mode 100644 index 000000000000..e85a7b0ec4af --- /dev/null +++ b/sys-fs/btrfs-progs/Manifest @@ -0,0 +1,5 @@ +AUX btrfs-progs-0.14-hotfix.patch 9100 RMD160 695024c56629fd37559f74f82ff0f2c338e1564f SHA1 486fdb9a44f2eddc2f1bb6e6b8487001e3666478 SHA256 28ef6ff950e71b1125a7b370f17c01fb0b3a7c5f6bd2b345fae5f227149ed4dd +DIST btrfs-progs-0.14.tar.bz2 95035 RMD160 2855a3859e8482212788538d6a49f3cb992c9316 SHA1 f66640ecad03f3a2bb4c69e0092433e39a8dcff7 SHA256 a91efe78248127a62fd4cb6bc782e2d2205ea2c7c5de334f0c02268d9eeab562 +EBUILD btrfs-progs-0.14.ebuild 640 RMD160 3793e7a6f330197020c1b6ef1f79d3dc83fdd48c SHA1 efdea184ad267def34b36f0f72a0322a025a62ab SHA256 c5966159287d1107fd40e0a17198e3ce3dace31b0375458c88c653a41be1117f +MISC ChangeLog 316 RMD160 a52f4a9e045cc7375cb80d9b2750f7fbf230ec46 SHA1 b93ee56678e88ca64c4129643dad6c8fa06ae2de SHA256 d61b4c5aa1fbdcb654b35f64e33633db7b34d23ba13bf1922dfe50b0c6aa3c91 +MISC metadata.xml 223 RMD160 0c9c59654305e8789fe6c93fd07c561cfe003f54 SHA1 7904e6fb45104baf2cb67fb9886c633af4dc7056 SHA256 a24b49fe5448d4cb329acf1d8113ac30eb1d61d63a7319b66c077d3f1775d055 diff --git a/sys-fs/btrfs-progs/btrfs-progs-0.14.ebuild b/sys-fs/btrfs-progs/btrfs-progs-0.14.ebuild new file mode 100644 index 000000000000..df97437314ab --- /dev/null +++ b/sys-fs/btrfs-progs/btrfs-progs-0.14.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/btrfs-progs/btrfs-progs-0.14.ebuild,v 1.1 2008/05/24 19:50:05 lavajoe Exp $ + +inherit eutils + +DESCRIPTION="Btrfs filesystem utilities" +HOMEPAGE="http://btrfs.wiki.kernel.org/" +SRC_URI="http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND="=sys-fs/btrfs-${PV}" + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}/${P}-hotfix.patch" +} + +src_install() { + into / + dosbin btrfs-show + dosbin btrfs-vol + dosbin btrfsctl + dosbin btrfsck + dosbin debug-tree + dosbin mkfs.btrfs + dosbin show-blocks + + dodoc INSTALL +} diff --git a/sys-fs/btrfs-progs/files/btrfs-progs-0.14-hotfix.patch b/sys-fs/btrfs-progs/files/btrfs-progs-0.14-hotfix.patch new file mode 100644 index 000000000000..5d40cf72151d --- /dev/null +++ b/sys-fs/btrfs-progs/files/btrfs-progs-0.14-hotfix.patch @@ -0,0 +1,268 @@ +diff -Nur btrfs-progs-0.14/.hg_archival.txt progs-c0d6cfa51166/.hg_archival.txt +--- btrfs-progs-0.14/.hg_archival.txt 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/.hg_archival.txt 2008-05-02 14:12:02.000000000 -0600 +@@ -1,2 +1,2 @@ + repo: 972e56533d49456b288abe364ba0295fa8c0e0ad +-node: 9a59768215d93fa8a3dcdcabe17d6555028ebbec ++node: c0d6cfa51166d680173dbe5b3dd283acbfe2265e +diff -Nur btrfs-progs-0.14/Makefile progs-c0d6cfa51166/Makefile +--- btrfs-progs-0.14/Makefile 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/Makefile 2008-05-02 14:12:02.000000000 -0600 +@@ -1,6 +1,6 @@ + CC=gcc + AM_CFLAGS = -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 +-CFLAGS = -g -Werror ++CFLAGS = -g -Werror -Os + objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ + root-tree.o dir-item.o hash.o file-item.o inode-item.o \ + inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o \ +diff -Nur btrfs-progs-0.14/bcp progs-c0d6cfa51166/bcp +--- btrfs-progs-0.14/bcp 1969-12-31 17:00:00.000000000 -0700 ++++ progs-c0d6cfa51166/bcp 2008-05-02 14:12:02.000000000 -0600 +@@ -0,0 +1,161 @@ ++#!/usr/bin/env python ++# Copyright (C) 2007 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. ++# ++import sys, os, stat, fcntl ++from optparse import OptionParser ++ ++def copylink(srcname, dst, filename, statinfo, force_name): ++ dstname = os.path.join(dst, force_name or filename) ++ if not os.path.exists(dstname): ++ link_target = os.readlink(srcname) ++ os.symlink(link_target, dstname) ++ ++def copydev(srcname, dst, filename, statinfo, force_name): ++ devbits = statinfo.st_mode & (stat.S_IFBLK | stat.S_IFCHR) ++ mode = stat.S_IMODE(statinfo.st_mode) | devbits ++ dstname = os.path.join(dst, force_name or filename) ++ if not os.path.exists(dstname): ++ os.mknod(dstname, mode, statinfo.st_rdev) ++ ++def copyfile(srcname, dst, filename, statinfo, force_name): ++ written = 0 ++ dstname = os.path.join(dst, force_name or filename) ++ ++ st_mode = statinfo.st_mode ++ if stat.S_ISLNK(st_mode): ++ copylink(srcname, dst, part, statinfo, None) ++ return ++ elif stat.S_ISBLK(st_mode) or stat.S_ISCHR(st_mode): ++ copydev(srcname, dst, part, statinfo, None) ++ return ++ elif not stat.S_ISREG(st_mode): ++ return ++ ++ try: ++ os.unlink(dstname) ++ except: ++ pass ++ ++ if options.link: ++ os.link(srcname, dstname) ++ return ++ ++ dstf = file(dstname, 'w') ++ srcf = file(srcname, 'r') ++ ++ ret = 1 ++ ++ try: ++ if not options.copy: ++ ret = fcntl.ioctl(dstf.fileno(), 1074041865, srcf.fileno()) ++ except: ++ pass ++ ++ if ret != 0: ++ while True: ++ buf = srcf.read(256 * 1024) ++ if not buf: ++ break ++ written += len(buf) ++ dstf.write(buf) ++ ++ os.chmod(dstname, stat.S_IMODE(statinfo.st_mode)) ++ os.chown(dstname, statinfo.st_uid, statinfo.st_gid) ++ ++ ++usage = "usage: %prog [options]" ++parser = OptionParser(usage=usage) ++parser.add_option("-l", "--link", help="Create hard links", default=False, ++ action="store_true") ++parser.add_option("-c", "--copy", help="Copy file bytes (don't cow)", ++ default=False, action="store_true") ++ ++(options,args) = parser.parse_args() ++ ++if len(args) < 2: ++ sys.stderr.write("source or destination not specified\n") ++ sys.exit(1) ++ ++if options.link and options.copy: ++ sys.stderr.write("Both -l and -c specified, using copy mode\n") ++ options.link = False ++ ++ ++total_args = len(args) ++src_args = total_args - 1 ++orig_dst = args[-1] ++ ++if src_args > 1: ++ if not os.path.exists(orig_dst): ++ os.makedirs(orig_dst) ++ if not os.path.isdir(orig_dst): ++ sys.stderr.write("Destination %s is not a directory\n" % orig_dst) ++ exit(1) ++ ++for srci in xrange(0, src_args): ++ src = args[srci] ++ if os.path.isfile(src): ++ statinfo = os.lstat(src) ++ force_name = None ++ if src_args == 1: ++ if not os.path.isdir(orig_dst): ++ force_name = os.path.basename(orig_dst) ++ orig_dst = os.path.dirname(orig_dst) or '.' ++ copyfile(src, orig_dst, os.path.basename(src), statinfo, force_name) ++ continue ++ ++ if src_args > 1 or os.path.exists(orig_dst): ++ dst = os.path.join(orig_dst, os.path.basename(src)) ++ else: ++ dst = orig_dst ++ ++ if not os.path.exists(dst): ++ os.makedirs(dst) ++ statinfo = os.stat(src) ++ os.chmod(dst, stat.S_IMODE(statinfo.st_mode)) ++ os.chown(dst, statinfo.st_uid, statinfo.st_gid) ++ ++ iter = os.walk(src, topdown=True) ++ ++ for (dirpath, dirnames, filenames) in iter: ++ for x in dirnames: ++ srcname = os.path.join(dirpath, x) ++ statinfo = os.lstat(srcname) ++ ++ if srcname.startswith(src): ++ part = srcname[len(src) + 1:] ++ ++ if stat.S_ISLNK(statinfo.st_mode): ++ copylink(srcname, dst, part, statinfo, None) ++ continue ++ ++ dst_dir = os.path.join(dst, part) ++ if not os.path.exists(dst_dir): ++ os.makedirs(dst_dir) ++ ++ os.chmod(dst_dir, stat.S_IMODE(statinfo.st_mode)) ++ os.chown(dst_dir, statinfo.st_uid, statinfo.st_gid) ++ ++ for f in filenames: ++ srcname = os.path.join(dirpath, f) ++ if srcname.startswith(src): ++ part = srcname[len(src) + 1:] ++ ++ statinfo = os.lstat(srcname) ++ copyfile(srcname, dst, part, statinfo, None) ++ ++ +diff -Nur btrfs-progs-0.14/btrfs-vol.c progs-c0d6cfa51166/btrfs-vol.c +--- btrfs-progs-0.14/btrfs-vol.c 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/btrfs-vol.c 2008-05-02 14:12:02.000000000 -0600 +@@ -71,9 +71,9 @@ + char *mnt = NULL; + int ret; + int option_index = 0; +- int cmd; ++ int cmd = 0; + int fd; +- int devfd; ++ int devfd = 0; + DIR *dirstream; + struct btrfs_ioctl_vol_args args; + u64 dev_block_count = 0; +diff -Nur btrfs-progs-0.14/btrfsck.c progs-c0d6cfa51166/btrfsck.c +--- btrfs-progs-0.14/btrfsck.c 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/btrfsck.c 2008-05-02 14:12:02.000000000 -0600 +@@ -606,6 +606,9 @@ + + data_bytes_allocated += + btrfs_file_extent_disk_num_bytes(buf, fi); ++ if (data_bytes_allocated < root->sectorsize) { ++ abort(); ++ } + data_bytes_referenced += + btrfs_file_extent_num_bytes(buf, fi); + ret = add_extent_rec(extent_cache, NULL, bytenr, +diff -Nur btrfs-progs-0.14/ioctl.h progs-c0d6cfa51166/ioctl.h +--- btrfs-progs-0.14/ioctl.h 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/ioctl.h 2008-05-02 14:12:02.000000000 -0600 +@@ -36,6 +36,7 @@ + struct btrfs_ioctl_vol_args) + #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \ + struct btrfs_ioctl_vol_args) ++#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) + #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \ + struct btrfs_ioctl_vol_args) + #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \ +diff -Nur btrfs-progs-0.14/mkfs.c progs-c0d6cfa51166/mkfs.c +--- btrfs-progs-0.14/mkfs.c 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/mkfs.c 2008-05-02 14:12:02.000000000 -0600 +@@ -308,7 +308,7 @@ + u64 block_count = 0; + u64 dev_block_count = 0; + u64 blocks[6]; +- u64 alloc_start; ++ u64 alloc_start = 0; + u64 metadata_profile = BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_DUP; + u64 data_profile = BTRFS_BLOCK_GROUP_RAID0; + u32 leafsize = getpagesize(); +diff -Nur btrfs-progs-0.14/utils.c progs-c0d6cfa51166/utils.c +--- btrfs-progs-0.14/utils.c 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/utils.c 2008-05-02 14:12:02.000000000 -0600 +@@ -645,7 +645,7 @@ + + int btrfs_scan_one_dir(char *dirname, int run_ioctl) + { +- DIR *dirp; ++ DIR *dirp = NULL; + struct dirent *dirent; + struct pending_dir *pending; + struct stat st; +@@ -734,7 +734,8 @@ + ret = 0; + fail: + free(pending); +- closedir(dirp); ++ if (dirp) ++ closedir(dirp); + return ret; + } + +diff -Nur btrfs-progs-0.14/volumes.c progs-c0d6cfa51166/volumes.c +--- btrfs-progs-0.14/volumes.c 2008-04-29 12:29:18.000000000 -0600 ++++ progs-c0d6cfa51166/volumes.c 2008-05-02 14:12:02.000000000 -0600 +@@ -478,7 +478,7 @@ + struct extent_buffer *leaf; + struct btrfs_key key; + unsigned long ptr; +- u64 free_devid; ++ u64 free_devid = 0; + + root = root->fs_info->chunk_root; + diff --git a/sys-fs/btrfs-progs/metadata.xml b/sys-fs/btrfs-progs/metadata.xml new file mode 100644 index 000000000000..fa0705095167 --- /dev/null +++ b/sys-fs/btrfs-progs/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>no-herd</herd> +<maintainer> + <email>lavajoe@gentoo.org</email> +</maintainer> +</pkgmetadata> diff --git a/sys-fs/btrfs/ChangeLog b/sys-fs/btrfs/ChangeLog new file mode 100644 index 000000000000..3cdf1145bf1e --- /dev/null +++ b/sys-fs/btrfs/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for sys-fs/btrfs +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/btrfs/ChangeLog,v 1.1 2008/05/24 19:49:32 lavajoe Exp $ + +*btrfs-0.14 (24 May 2008) + + 24 May 2008; Joe Peterson <lavajoe@gentoo.org> + +files/btrfs-0.14-hotfix.patch, +metadata.xml, +btrfs-0.14.ebuild: + New package: Btrfs filesystem kernel module + diff --git a/sys-fs/btrfs/Manifest b/sys-fs/btrfs/Manifest new file mode 100644 index 000000000000..17cfa5b6b91c --- /dev/null +++ b/sys-fs/btrfs/Manifest @@ -0,0 +1,5 @@ +AUX btrfs-0.14-hotfix.patch 14508 RMD160 df98080a725a9882ca3185c87421f8ac4c5266f2 SHA1 2d9dca87cde74b0943947d35cf6f0c09980cb9da SHA256 0e6370569cf70da7160398bbaa41b725b77a46ba1597b7db80bb1f85e4be0788 +DIST btrfs-0.14.tar.bz2 103694 RMD160 0e3fa6ee1583452a4818356dff1f2868502811a1 SHA1 1265a79c9b0e87858fcba319854b601b865d097c SHA256 b57a853a0ec0152c3561688a1fd250b68e361b6d0fd0bd6526802a2d7829bcf9 +EBUILD btrfs-0.14.ebuild 1248 RMD160 2a46c68c260272bb35d0db84043a80658444f700 SHA1 ada3e633008c0eff648a704bf7ff66f70e3bcb37 SHA256 7452b8a4d566bf66edeaa82afafed5dbfa1379e75c51dac4460aba06bd1728d8 +MISC ChangeLog 305 RMD160 8e205d09731f918fbe5b39dbb997ff1ab51593f2 SHA1 2500779858fd9cb59cb5ad54b711010e4ea3afa8 SHA256 32f48513150c02643eeefc6a8c6d48dddaa37e1dff31b2378e2523bda2690fbc +MISC metadata.xml 223 RMD160 0c9c59654305e8789fe6c93fd07c561cfe003f54 SHA1 7904e6fb45104baf2cb67fb9886c633af4dc7056 SHA256 a24b49fe5448d4cb329acf1d8113ac30eb1d61d63a7319b66c077d3f1775d055 diff --git a/sys-fs/btrfs/btrfs-0.14.ebuild b/sys-fs/btrfs/btrfs-0.14.ebuild new file mode 100644 index 000000000000..198d57a8586a --- /dev/null +++ b/sys-fs/btrfs/btrfs-0.14.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/btrfs/btrfs-0.14.ebuild,v 1.1 2008/05/24 19:49:32 lavajoe Exp $ + +inherit eutils linux-mod + +DESCRIPTION="A checksumming copy-on-write filesystem" +HOMEPAGE="http://btrfs.wiki.kernel.org/" +SRC_URI="http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="sys-fs/e2fsprogs" +PDEPEND="=sys-fs/btrfs-progs-${PV}" + +pkg_setup() +{ + linux-mod_pkg_setup + + BUILD_TARGETS="all" + BUILD_PARAMS="KERNELDIR=/lib/modules/${KV_FULL}/build" + MODULE_NAMES="btrfs(fs:${S}/" + + if ! kernel_is 2 6; then + eerror "Need a 2.6 kernel to compile against!" + die "Need a 2.6 kernel to compile against!" + fi + + if ! linux_chkconfig_present LIBCRC32C; then + eerror "You need to enable LIBCRC32C in your kernel!" + die "You need to enable LIBCRC32C in your kernel!" + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}/${P}-hotfix.patch" +} + +src_install() +{ + linux-mod_src_install + + dodoc INSTALL TODO +} + +pkg_postinst() { + linux-mod_pkg_postinst + + ewarn "WARNING: Btrfs is under heavy development, and is not suitable for" + ewarn "any uses other than benchmarking and review." + ewarn "The Btrfs disk format is not yet finalized." +} diff --git a/sys-fs/btrfs/files/btrfs-0.14-hotfix.patch b/sys-fs/btrfs/files/btrfs-0.14-hotfix.patch new file mode 100644 index 000000000000..58e9ec197543 --- /dev/null +++ b/sys-fs/btrfs/files/btrfs-0.14-hotfix.patch @@ -0,0 +1,465 @@ +diff -Nur btrfs-0.14/.hg_archival.txt kernel-f6ba18a50ad7/.hg_archival.txt +--- btrfs-0.14/.hg_archival.txt 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/.hg_archival.txt 2008-05-02 14:13:49.000000000 -0600 +@@ -1,2 +1,2 @@ + repo: 972e56533d49456b288abe364ba0295fa8c0e0ad +-node: c9b946757d2354bed791012e3a924ccac9bf5d38 ++node: f6ba18a50ad79a1387c86c055d9a411c82b10e80 +diff -Nur btrfs-0.14/compat.h kernel-f6ba18a50ad7/compat.h +--- btrfs-0.14/compat.h 1969-12-31 17:00:00.000000000 -0700 ++++ kernel-f6ba18a50ad7/compat.h 2008-05-02 14:13:49.000000000 -0600 +@@ -0,0 +1,25 @@ ++#ifndef _COMPAT_H_ ++#define _COMPAT_H_ ++ ++ ++/* ++ * Even if AppArmor isn't enabled, it still has different prototypes. ++ * Add more distro/version pairs here to declare which has AppArmor applied. ++ */ ++#if defined(CONFIG_SUSE_KERNEL) ++# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) ++# define REMOVE_SUID_PATH 1 ++# endif ++#endif ++ ++/* ++ * catch any other distros that have patched in apparmor. This isn't ++ * 100% reliable because it won't catch people that hand compile their ++ * own distro kernels without apparmor compiled in. But, it is better ++ * than nothing. ++ */ ++#ifdef CONFIG_SECURITY_APPARMOR ++# define REMOVE_SUID_PATH 1 ++#endif ++ ++#endif /* _COMPAT_H_ */ +diff -Nur btrfs-0.14/ctree.h kernel-f6ba18a50ad7/ctree.h +--- btrfs-0.14/ctree.h 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/ctree.h 2008-05-02 14:13:49.000000000 -0600 +@@ -1516,9 +1516,9 @@ + /* file-item.c */ + int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, + struct btrfs_root *root, +- u64 objectid, u64 pos, u64 offset, ++ u64 objectid, u64 pos, u64 disk_offset, + u64 disk_num_bytes, +- u64 num_bytes); ++ u64 num_bytes, u64 offset); + int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct btrfs_path *path, u64 objectid, +diff -Nur btrfs-0.14/disk-io.c kernel-f6ba18a50ad7/disk-io.c +--- btrfs-0.14/disk-io.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/disk-io.c 2008-05-02 14:13:49.000000000 -0600 +@@ -1548,6 +1548,7 @@ + btrfs_commit_transaction(trans, root); + ret = btrfs_write_and_wait_transaction(NULL, root); + BUG_ON(ret); ++ + write_ctree_super(NULL, root); + mutex_unlock(&fs_info->fs_mutex); + +@@ -1583,17 +1584,17 @@ + extent_io_tree_empty_lru(&fs_info->extent_ins); + extent_io_tree_empty_lru(&BTRFS_I(fs_info->btree_inode)->io_tree); + +- flush_workqueue(end_io_workqueue); + flush_workqueue(async_submit_workqueue); ++ flush_workqueue(end_io_workqueue); + + truncate_inode_pages(fs_info->btree_inode->i_mapping, 0); + +- flush_workqueue(end_io_workqueue); +- destroy_workqueue(end_io_workqueue); +- + flush_workqueue(async_submit_workqueue); + destroy_workqueue(async_submit_workqueue); + ++ flush_workqueue(end_io_workqueue); ++ destroy_workqueue(end_io_workqueue); ++ + iput(fs_info->btree_inode); + #if 0 + while(!list_empty(&fs_info->hashers)) { +@@ -1663,8 +1664,21 @@ + + void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr) + { +- balance_dirty_pages_ratelimited_nr( ++ struct extent_io_tree *tree; ++ u64 num_dirty; ++ u64 start = 0; ++ unsigned long thresh = 16 * 1024 * 1024; ++ tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; ++ ++ if (current_is_pdflush()) ++ return; ++ ++ num_dirty = count_range_bits(tree, &start, (u64)-1, ++ thresh, EXTENT_DIRTY); ++ if (num_dirty > thresh) { ++ balance_dirty_pages_ratelimited_nr( + root->fs_info->btree_inode->i_mapping, 1); ++ } + } + + void btrfs_set_buffer_defrag(struct extent_buffer *buf) +diff -Nur btrfs-0.14/file-item.c kernel-f6ba18a50ad7/file-item.c +--- btrfs-0.14/file-item.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/file-item.c 2008-05-02 14:13:49.000000000 -0600 +@@ -28,10 +28,10 @@ + sizeof(struct btrfs_item) * 2) / \ + BTRFS_CRC32_SIZE) - 1)) + int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, +- struct btrfs_root *root, +- u64 objectid, u64 pos, +- u64 offset, u64 disk_num_bytes, +- u64 num_bytes) ++ struct btrfs_root *root, ++ u64 objectid, u64 pos, ++ u64 disk_offset, u64 disk_num_bytes, ++ u64 num_bytes, u64 offset) + { + int ret = 0; + struct btrfs_file_extent_item *item; +@@ -53,9 +53,9 @@ + leaf = path->nodes[0]; + item = btrfs_item_ptr(leaf, path->slots[0], + struct btrfs_file_extent_item); +- btrfs_set_file_extent_disk_bytenr(leaf, item, offset); ++ btrfs_set_file_extent_disk_bytenr(leaf, item, disk_offset); + btrfs_set_file_extent_disk_num_bytes(leaf, item, disk_num_bytes); +- btrfs_set_file_extent_offset(leaf, item, 0); ++ btrfs_set_file_extent_offset(leaf, item, offset); + btrfs_set_file_extent_num_bytes(leaf, item, num_bytes); + btrfs_set_file_extent_generation(leaf, item, trans->transid); + btrfs_set_file_extent_type(leaf, item, BTRFS_FILE_EXTENT_REG); +diff -Nur btrfs-0.14/file.c kernel-f6ba18a50ad7/file.c +--- btrfs-0.14/file.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/file.c 2008-05-02 14:13:49.000000000 -0600 +@@ -37,6 +37,7 @@ + #include "ordered-data.h" + #include "ioctl.h" + #include "print-tree.h" ++#include "compat.h" + + + static int btrfs_copy_from_user(loff_t pos, int num_pages, int write_bytes, +@@ -285,7 +286,7 @@ + err = btrfs_insert_file_extent(trans, root, + inode->i_ino, + last_pos_in_file, +- 0, 0, hole_size); ++ 0, 0, hole_size, 0); + btrfs_drop_extent_cache(inode, last_pos_in_file, + last_pos_in_file + hole_size -1); + btrfs_check_file(root, inode); +@@ -852,7 +853,11 @@ + goto out_nolock; + if (count == 0) + goto out_nolock; ++#ifdef REMOVE_SUID_PATH ++ err = remove_suid(&file->f_path); ++#else + err = remove_suid(fdentry(file)); ++#endif + if (err) + goto out_nolock; + file_update_time(file); +@@ -961,7 +966,7 @@ + if (err < 0) + num_written = err; + } else if (num_written > 0 && (file->f_flags & O_DIRECT)) { +-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + do_sync_file_range(file, start_pos, + start_pos + num_written - 1, + SYNC_FILE_RANGE_WRITE | +diff -Nur btrfs-0.14/inode.c kernel-f6ba18a50ad7/inode.c +--- btrfs-0.14/inode.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/inode.c 2008-05-02 14:13:49.000000000 -0600 +@@ -19,6 +19,7 @@ + #include <linux/kernel.h> + #include <linux/bio.h> + #include <linux/buffer_head.h> ++#include <linux/file.h> + #include <linux/fs.h> + #include <linux/pagemap.h> + #include <linux/highmem.h> +@@ -141,7 +142,7 @@ + cur_alloc_size = ins.offset; + ret = btrfs_insert_file_extent(trans, root, inode->i_ino, + start, ins.objectid, ins.offset, +- ins.offset); ++ ins.offset, 0); + inode->i_blocks += ins.offset >> 9; + btrfs_check_file(root, inode); + if (num_bytes < cur_alloc_size) { +@@ -1227,7 +1228,7 @@ + err = btrfs_insert_file_extent(trans, root, + inode->i_ino, + hole_start, 0, 0, +- hole_size); ++ hole_size, 0); + btrfs_drop_extent_cache(inode, hole_start, + (u64)-1); + btrfs_check_file(root, inode); +@@ -2034,12 +2035,12 @@ + + static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) + { +- struct inode *inode; ++ struct inode *inode = NULL; + struct btrfs_trans_handle *trans; + struct btrfs_root *root = BTRFS_I(dir)->root; + int err = 0; + int drop_on_err = 0; +- u64 objectid; ++ u64 objectid = 0; + unsigned long nr = 1; + + mutex_lock(&root->fs_info->fs_mutex); +@@ -3100,6 +3101,170 @@ + return ret; + } + ++void dup_item_to_inode(struct btrfs_trans_handle *trans, ++ struct btrfs_root *root, ++ struct btrfs_path *path, ++ struct extent_buffer *leaf, ++ int slot, ++ struct btrfs_key *key, ++ u64 destino) ++{ ++ struct btrfs_path *cpath = btrfs_alloc_path(); ++ int len = btrfs_item_size_nr(leaf, slot); ++ int dstoff; ++ struct btrfs_key ckey = *key; ++ int ret; ++ ++ ckey.objectid = destino; ++ ret = btrfs_insert_empty_item(trans, root, cpath, &ckey, len); ++ dstoff = btrfs_item_ptr_offset(cpath->nodes[0], cpath->slots[0]); ++ copy_extent_buffer(cpath->nodes[0], leaf, dstoff, ++ btrfs_item_ptr_offset(leaf, slot), ++ len); ++ btrfs_release_path(root, cpath); ++} ++ ++long btrfs_ioctl_clone(struct file *file, unsigned long src_fd) ++{ ++ struct inode *inode = fdentry(file)->d_inode; ++ struct btrfs_root *root = BTRFS_I(inode)->root; ++ struct file *src_file; ++ struct inode *src; ++ struct btrfs_trans_handle *trans; ++ int ret; ++ u64 pos; ++ struct btrfs_path *path; ++ struct btrfs_key key; ++ struct extent_buffer *leaf; ++ u32 nritems; ++ int nextret; ++ int slot; ++ ++ src_file = fget(src_fd); ++ if (!src_file) ++ return -EBADF; ++ src = src_file->f_dentry->d_inode; ++ ++ ret = -EXDEV; ++ if (src->i_sb != inode->i_sb) ++ goto out_fput; ++ ++ if (inode < src) { ++ mutex_lock(&inode->i_mutex); ++ mutex_lock(&src->i_mutex); ++ } else { ++ mutex_lock(&src->i_mutex); ++ mutex_lock(&inode->i_mutex); ++ } ++ ++ ret = -ENOTEMPTY; ++ if (inode->i_size) ++ goto out_unlock; ++ ++ /* do any pending delalloc/csum calc on src, one way or ++ another, and lock file content */ ++ while (1) { ++ filemap_write_and_wait(src->i_mapping); ++ lock_extent(&BTRFS_I(src)->io_tree, 0, (u64)-1, GFP_NOFS); ++ if (BTRFS_I(src)->delalloc_bytes == 0) ++ break; ++ unlock_extent(&BTRFS_I(src)->io_tree, 0, (u64)-1, GFP_NOFS); ++ } ++ ++ mutex_lock(&root->fs_info->fs_mutex); ++ trans = btrfs_start_transaction(root, 0); ++ path = btrfs_alloc_path(); ++ pos = 0; ++ while (1) { ++ ret = btrfs_lookup_file_extent(trans, root, path, src->i_ino, ++ pos, 0); ++ if (ret < 0) ++ goto out; ++ if (ret > 0) { ++ if (path->slots[0] == 0) { ++ ret = 0; ++ goto out; ++ } ++ path->slots[0]--; ++ } ++next_slot: ++ leaf = path->nodes[0]; ++ slot = path->slots[0]; ++ btrfs_item_key_to_cpu(leaf, &key, slot); ++ nritems = btrfs_header_nritems(leaf); ++ ++ if (btrfs_key_type(&key) > BTRFS_CSUM_ITEM_KEY || ++ key.objectid != src->i_ino) ++ goto out; ++ if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY) { ++ struct btrfs_file_extent_item *extent; ++ int found_type; ++ pos = key.offset; ++ extent = btrfs_item_ptr(leaf, slot, ++ struct btrfs_file_extent_item); ++ found_type = btrfs_file_extent_type(leaf, extent); ++ if (found_type == BTRFS_FILE_EXTENT_REG) { ++ u64 len = btrfs_file_extent_num_bytes(leaf, ++ extent); ++ u64 ds = btrfs_file_extent_disk_bytenr(leaf, ++ extent); ++ u64 dl = btrfs_file_extent_disk_num_bytes(leaf, ++ extent); ++ u64 off = btrfs_file_extent_offset(leaf, ++ extent); ++ btrfs_insert_file_extent(trans, root, ++ inode->i_ino, pos, ++ ds, dl, len, off); ++ /* ds == 0 means there's a hole */ ++ if (ds != 0) { ++ btrfs_inc_extent_ref(trans, root, ++ ds, dl, ++ root->root_key.objectid, ++ trans->transid, ++ inode->i_ino, pos); ++ } ++ pos = key.offset + len; ++ } else if (found_type == BTRFS_FILE_EXTENT_INLINE) { ++ dup_item_to_inode(trans, root, path, leaf, slot, ++ &key, inode->i_ino); ++ pos = key.offset + btrfs_item_size_nr(leaf, ++ slot); ++ } ++ } else if (btrfs_key_type(&key) == BTRFS_CSUM_ITEM_KEY) ++ dup_item_to_inode(trans, root, path, leaf, slot, &key, ++ inode->i_ino); ++ ++ if (slot >= nritems - 1) { ++ nextret = btrfs_next_leaf(root, path); ++ if (nextret) ++ goto out; ++ } else { ++ path->slots[0]++; ++ } ++ goto next_slot; ++ } ++ ++out: ++ btrfs_free_path(path); ++ ret = 0; ++ ++ inode->i_blocks = src->i_blocks; ++ i_size_write(inode, src->i_size); ++ btrfs_update_inode(trans, root, inode); ++ ++ unlock_extent(&BTRFS_I(src)->io_tree, 0, (u64)-1, GFP_NOFS); ++ ++ btrfs_end_transaction(trans, root); ++ mutex_unlock(&root->fs_info->fs_mutex); ++ ++out_unlock: ++ mutex_unlock(&src->i_mutex); ++ mutex_unlock(&inode->i_mutex); ++out_fput: ++ fput(src_file); ++ return ret; ++} ++ + long btrfs_ioctl(struct file *file, unsigned int + cmd, unsigned long arg) + { +@@ -3116,6 +3281,8 @@ + return btrfs_ioctl_add_dev(root, (void __user *)arg); + case BTRFS_IOC_BALANCE: + return btrfs_balance(root->fs_info->dev_root); ++ case BTRFS_IOC_CLONE: ++ return btrfs_ioctl_clone(file, arg); + } + + return -ENOTTY; +diff -Nur btrfs-0.14/ioctl.h kernel-f6ba18a50ad7/ioctl.h +--- btrfs-0.14/ioctl.h 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/ioctl.h 2008-05-02 14:13:49.000000000 -0600 +@@ -36,6 +36,7 @@ + struct btrfs_ioctl_vol_args) + #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \ + struct btrfs_ioctl_vol_args) ++#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) + #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \ + struct btrfs_ioctl_vol_args) + #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \ +diff -Nur btrfs-0.14/ordered-data.c kernel-f6ba18a50ad7/ordered-data.c +--- btrfs-0.14/ordered-data.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/ordered-data.c 2008-05-02 14:13:49.000000000 -0600 +@@ -18,6 +18,7 @@ + + #include <linux/gfp.h> + #include <linux/slab.h> ++#include <linux/blkdev.h> + #include "ctree.h" + #include "transaction.h" + #include "btrfs_inode.h" +diff -Nur btrfs-0.14/transaction.c kernel-f6ba18a50ad7/transaction.c +--- btrfs-0.14/transaction.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/transaction.c 2008-05-02 14:13:49.000000000 -0600 +@@ -814,6 +814,9 @@ + int ret; + + mutex_lock(&root->fs_info->fs_mutex); ++ if (root->fs_info->closing) ++ goto out; ++ + mutex_lock(&root->fs_info->trans_mutex); + cur = root->fs_info->running_transaction; + if (!cur) { +@@ -838,12 +841,13 @@ + + void btrfs_transaction_queue_work(struct btrfs_root *root, int delay) + { +- queue_delayed_work(trans_wq, &root->fs_info->trans_work, delay); ++ if (!root->fs_info->closing) ++ queue_delayed_work(trans_wq, &root->fs_info->trans_work, delay); + } + + void btrfs_transaction_flush_work(struct btrfs_root *root) + { +- cancel_rearming_delayed_workqueue(trans_wq, &root->fs_info->trans_work); ++ cancel_delayed_work(&root->fs_info->trans_work); + flush_workqueue(trans_wq); + } + +diff -Nur btrfs-0.14/volumes.c kernel-f6ba18a50ad7/volumes.c +--- btrfs-0.14/volumes.c 2008-04-29 12:28:55.000000000 -0600 ++++ kernel-f6ba18a50ad7/volumes.c 2008-05-02 14:13:49.000000000 -0600 +@@ -547,7 +547,7 @@ + struct extent_buffer *leaf; + struct btrfs_key key; + unsigned long ptr; +- u64 free_devid; ++ u64 free_devid = 0; + + root = root->fs_info->chunk_root; + diff --git a/sys-fs/btrfs/metadata.xml b/sys-fs/btrfs/metadata.xml new file mode 100644 index 000000000000..fa0705095167 --- /dev/null +++ b/sys-fs/btrfs/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>no-herd</herd> +<maintainer> + <email>lavajoe@gentoo.org</email> +</maintainer> +</pkgmetadata> |