Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Zach Brown
On Tue, Apr 14, 2015 at 12:23:25PM -0700, Christoph Hellwig wrote: > On Tue, Apr 14, 2015 at 11:54:08AM -0700, Zach Brown wrote: > > Is this relying on btrfs range cloning being atomic? It certainly > > doesn't look atomic. It can modify items across an arbitrarily larg

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Zach Brown
On Tue, Apr 14, 2015 at 02:29:06PM -0400, J. Bruce Fields wrote: > On Tue, Apr 14, 2015 at 11:22:41AM -0700, Zach Brown wrote: > > On Tue, Apr 14, 2015 at 02:19:11PM -0400, J. Bruce Fields wrote: > > > On Tue, Apr 14, 2015 at 01:16:13PM -0400, Anna Schumaker wrote: > > &g

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Zach Brown
On Tue, Apr 14, 2015 at 02:19:11PM -0400, J. Bruce Fields wrote: > On Tue, Apr 14, 2015 at 01:16:13PM -0400, Anna Schumaker wrote: > > On 04/14/2015 12:53 PM, Christoph Hellwig wrote: > > > On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff Layton wrote: > > >> Yuck! How the heck do you clean up the me

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-13 Thread Zach Brown
> > >> Could we perhaps instead of a length, define a 'pos_in_start' and a > > >> 'pos_in_end' offset (with the latter being -1 for a full-file copy) > > >> and then return an 'loff_t' value stating where the copy ended? > > > > > > Well, the resulting offset will be set if the caller provided it.

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-10 Thread Zach Brown
On Fri, Apr 10, 2015 at 06:36:41PM -0400, Trond Myklebust wrote: > On Fri, Apr 10, 2015 at 6:00 PM, Zach Brown wrote: > > + > > +/* > > + * copy_file_range() differs from regular file read and write in that it > > + * specifically allows return partial success

[PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-10 Thread Zach Brown
existing destination file descriptor, not a path. Currently the high level vfs entry point limits copy offloading to files on the same mount and super (and not in the same file). This can be relaxed if we get implementations which can copy between file systems safely. Signed-off-by: Zach Brown --- fs

[PATCH RFC 3/3] btrfs: add .copy_file_range file operation

2015-04-10 Thread Zach Brown
-off-by: Zach Brown --- fs/btrfs/ctree.h | 3 ++ fs/btrfs/file.c | 1 + fs/btrfs/ioctl.c | 91 3 files changed, 56 insertions(+), 39 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index f9c89ca..f7cfa26 100644 --- a/fs/btrfs

[PATCH RFC 0/3] simple copy offloading system call

2015-04-10 Thread Zach Brown
Hello everyone! Here's my current attempt at the most basic system call interface for offloading copying between files. The system call and vfs function are relatively light wrappers around the file_operation method that does the heavy lifting. There was interest at LSF in getting the basic infr

[PATCH RFC 2/3] x86: add sys_copy_file_range to syscall tables

2015-04-10 Thread Zach Brown
Add sys_copy_file_range to the x86 syscall tables. Signed-off-by: Zach Brown --- arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl index b3560ec

readdir tree/page lock inversion

2015-03-31 Thread Zach Brown
We've known for eons that it's not great that readdir holds tree locks while calling mkwrite by way of dir_emit(). I fiddled around and found a reliable if goofy deadlock reproducer. It typically takes a few seconds on modest hardware here (single package, dual core/ht, single spindle.) I made a

[PATCH] btrfs-progs: silence fake fsck

2015-03-27 Thread Zach Brown
my system, before gdm is started." I'm inclined to agree. This makes the tiniest change to remove the message that's output for an auto invocation. My guess is that it was just copied from the xfs fsck.xfs and that no one actually cares about it. Signed-off-by: Zach Brown --- fs

Re: [PATCH 1/3] dm: log writes target V2

2015-03-20 Thread Zach Brown
; V1->V2: fixed up stuff based on Zachs review. Cool, Reviewed-by: Zach Brown - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 1/3] dm: log writes target

2015-03-19 Thread Zach Brown
On Thu, Mar 19, 2015 at 04:31:08PM -0400, Josef Bacik wrote: > This creates a new target that is meant for file system developers to test > file > system integrity at particular points in the life of a file system. Hi Josef, just a quick drive-by review for stuff that jumps out at me.. > + a

Re: [PATCH v2] Btrfs: Add code to support file creation time

2015-01-22 Thread Zach Brown
> @@ -5729,6 +5744,7 @@ static struct inode *btrfs_new_inode(struct > btrfs_trans_handle *trans, > struct btrfs_path *path; > struct btrfs_inode_ref *ref; > struct btrfs_key key[2]; > + struct timespec current_time; > u32 sizes[2]; > int nitems = name ? 2 : 1; >

Re: btrfs scrub status reports not running when it is

2015-01-15 Thread Zach Brown
On Thu, Jan 15, 2015 at 12:24:41PM +0100, David Sterba wrote: > On Wed, Jan 14, 2015 at 02:27:17PM -0800, Zach Brown wrote: > > On Wed, Jan 14, 2015 at 04:06:02PM -0500, Sandy McArthur Jr wrote: > > > Sometimes btrfs scrub status reports that is not running when it still is. &g

Re: btrfs scrub status reports not running when it is

2015-01-14 Thread Zach Brown
On Wed, Jan 14, 2015 at 04:06:02PM -0500, Sandy McArthur Jr wrote: > Sometimes btrfs scrub status reports that is not running when it still is. > > I think this a cosmetic bug. And I believe this is related to the > scrub completing on some drives before others in a multi-drive btrfs > filesystem

Re: [RFC][PATCH] dm: add dm-power-fail target

2014-11-24 Thread Zach Brown
> >>That is way complicated, I was just going to take two devices, one that's a > >>linear mapping and the other that's the log, and then write to the log the > >>sector+data that was written in order that it completes, and then have > >>userspace do the replay. So basically do the flush tracking

Re: [RFC][PATCH] dm: add dm-power-fail target

2014-11-24 Thread Zach Brown
On Mon, Nov 24, 2014 at 03:15:25PM -0500, Josef Bacik wrote: > On 11/24/2014 02:57 PM, Zach Brown wrote: > >>>This implements a writeback cache in kernel data structures so that you > >>>can race to throw away cached blocks that haven't been flushed. How is >

Re: [RFC][PATCH] dm: add dm-power-fail target

2014-11-24 Thread Zach Brown
> >This implements a writeback cache in kernel data structures so that you > >can race to throw away cached blocks that haven't been flushed. How is > >that meaningfully different than using an actual writeback caching dm > >target and racing to invalidate it? > > I didn't think of the dm-cache t

Re: [RFC][PATCH] dm: add dm-power-fail target

2014-11-24 Thread Zach Brown
On Fri, Nov 21, 2014 at 05:00:31PM -0500, Josef Bacik wrote: > Hello, > > I'm hoping some FS guys can weigh in and verify my approach for testing power > fail conditions, and the DM guys to of course verify I didn't completely fail > at > making a DM target. All suggestions welcome, I want to ha

[PATCH 2/4] btrfs-progs: check read extent errors when mapping

2014-10-15 Thread Zach Brown
) return -errno pread errors instead of -EIO or -1 (-EPERM). The only other caller who tests errors clobbers them with -EIO. Signed-off-by: Zach Brown --- btrfs-map-logical.c | 12 +++- extent_io.c | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/btrfs-map-lo

[PATCH 3/4] btrfs-progs: fix show super unknown flag output

2014-10-15 Thread Zach Brown
t the unknown flag first. Signed-off-by: Zach Brown --- btrfs-show-super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index 456dbd8..2b48f44 100644 --- a/btrfs-show-super.c +++ b/btrfs-show-super.c @@ -324,8 +324,8 @@ static

[PATCH 4/4] btrfs-progs: fix csum root copy-n-paste error

2014-10-15 Thread Zach Brown
btrfs_setup_all_roots() had some copy and pasted code for trying to setup a root and then creating a blank node if that failed. The copy for the csum_root created the blank node in the extent_root. So we create a function to use a consistent root. Signed-off-by: Zach Brown --- disk-io.c | 66

[PATCH 0/4] some btrfs-progs coverity fixes

2014-10-15 Thread Zach Brown
Hi gang, Here's another set of coverity fixes for btrfs-progs against David's integration-20141007 branch. I got tired of adding error checking after a few so I moved on to the other warnings. Maybe we should subscribe linux-btrfs to the reports that coverity can send out? - z -- To unsubscri

[PATCH 1/4] btrfs-progs: check sscanf return code

2014-10-15 Thread Zach Brown
coverity warned that the return code from sscanf() assigned to 'i' wasn't checked before being assigned again. Check it. Signed-off-by: Zach Brown --- utils.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils.c b/utils.c index c2f30d4..51e55be 10064

Re: [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment

2014-10-15 Thread Zach Brown
On Tue, Oct 14, 2014 at 10:18:09PM +0200, Fabian Frederick wrote: > > > > On 14 October 2014 at 21:15 Zach Brown wrote: > > > > > > On Tue, Oct 14, 2014 at 07:46:14PM +0200, Fabian Frederick wrote: > > > use function defined in include/linux/highme

Re: [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment

2014-10-14 Thread Zach Brown
On Tue, Oct 14, 2014 at 07:46:14PM +0200, Fabian Frederick wrote: > use function defined in include/linux/highmem.h > Note that this reverts 2 last function call order And adds a BUG_ON(PAGE_CACHE_SIZE > PAGE_SIZE). We can take bets on whether that will ever trigger. - z -- To unsubscribe from t

Re: [PATCH 0/2] Remove branch hints

2014-10-03 Thread Zach Brown
kernel.org/pub/scm/linux/kernel/git/kdave/linux.git > remove-unlikely > > David Sterba (2): > btrfs: remove unlikely from NULL checks > btrfs: remove unlikely from data-dependent branches and slow paths Enthusiastically-Reviewed-by: Zach Brown - z -- To unsubscribe from thi

Re: [PATCH v2 1/3] btrfs: replace open-coded kernel_write

2014-09-30 Thread Zach Brown
On Tue, Sep 30, 2014 at 03:01:40PM -0700, Omar Sandoval wrote: > write_buf used by btrfs send has what is more or less a reimplementation of > kernel_write. This also gets rid of a sparse address space warning. Seems reasonable to me: Reviewed-by: Zach Brown - z -- To unsubscribe fro

Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-30 Thread Zach Brown
On Sun, Sep 28, 2014 at 03:26:04PM -0700, Omar Sandoval wrote: > On Sun, Sep 28, 2014 at 01:48:11AM -0700, Omar Sandoval wrote: > > diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c > > index 6528aa6..e0be577 100644 > > --- a/fs/btrfs/send.c > > +++ b/fs/btrfs/send.c > > @@ -515,7 +515,8 @@ static int

Re: [PATCH] btrfs-progs: Don't return any fs_info that contain NULL tree_root or fs_root.

2014-09-30 Thread Zach Brown
> btrfs_setup_all_roots(). Please test if it fixes the crash with the > corrupted image you have. Thanks. Perhaps with a test in xfstests. - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at ht

Re: [PATCH] Btrfs-progs: let btrfs-image actually work on a balanced fs

2014-09-25 Thread Zach Brown
> --- a/btrfs-image.c > +++ b/btrfs-image.c > @@ -1020,6 +1020,9 @@ static int copy_tree_blocks(struct btrfs_root *root, > struct extent_buffer *eb, > int i = 0; > int ret; > > + if (btrfs_header_bytenr(eb) == 65536) > + printf("We have bytenr 65536, belongs to %llu,

Re: Performance Issues

2014-09-19 Thread Zach Brown
On Fri, Sep 19, 2014 at 01:51:22PM +, Holger Hoffstätte wrote: > > On Fri, 19 Sep 2014 13:18:34 +0100, Rob Spanton wrote: > > > I have a particularly uncomplicated setup (a desktop PC with a hard > > disk) and I'm seeing particularly slow performance from btrfs. A `git > > status` in the lin

Re: Setting FS_USERNS_MOUNT in btrfs_fs_type.fs_flags

2014-09-17 Thread Zach Brown
On Wed, Sep 17, 2014 at 04:54:48AM +0100, Al Viro wrote: > On Tue, Sep 16, 2014 at 11:05:00PM -0400, Shea Levy wrote: > > Hi all, > > > > What work would be required to mark btrfs_fs_type with FS_USERNS_MOUNT > > so that btrfs images can be mounted by unprivileged users within a user > > namespace

Re: [PATCH] btrfs-progs: per-thread, per-call pretty buffer

2014-09-05 Thread Zach Brown
> Great! Thanks Zach for your quick patch. it works. Cool. > > From 3d132362f4c87b065b63cb38726a030db2277919 Mon Sep 17 00:00:00 2001 > >From: Zach Brown > >Date: Thu, 4 Sep 2014 12:32:00 -0700 > >Subject: [PATCH] btrfs-progs: use pretty printing macros David, le

Re: [PATCH] btrfs-progs: per-thread, per-call pretty buffer

2014-09-04 Thread Zach Brown
by default because reasons! Yeah!) - z >From 3d132362f4c87b065b63cb38726a030db2277919 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 4 Sep 2014 12:32:00 -0700 Subject: [PATCH] btrfs-progs: use pretty printing macros The original pretty printing code was a mess and required callers to allocate an

Re: [PATCH] btrfs-progs: readahead errors are not fatal

2014-08-27 Thread Zach Brown
nd only returns 0.. so maybe remove the bug_on something like this totally untested patch? There's another "#if 0"-ed out caller in extent-tree.c but that nonsense should just be removed. - z commit 69a668994c70cc1fd86d1c349d272b1cbfde23b1 Author: Zach Brown Date: Wed Aug 27 11:0

Re: btrfs receive problem on ARM kirkwood NAS with kernel 3.16.0 and btrfs-progs 3.14.2

2014-08-21 Thread Zach Brown
On Thu, Aug 21, 2014 at 09:03:16PM +0200, Klaus Holler wrote: > Hello Hugo and Zach! > > a big thanks to both of you! > > Both Hugo's userspace workaround and > Zach's patch work fine for me - the /boot snapshot can be restored > completely as expected :-) Cool, glad to hear it. I sent a proper

[PATCH] btrfs-progs: fix unaligned loads in receive

2014-08-21 Thread Zach Brown
were on a platform that corrupts unaligned userspace loads. Loading the u64s from the unaligned pointers into the received command stream with get_unaligned() fixed the problem. Reported-By: Klaus Holler Tested-By: Klaus Holler Signed-off-by: Zach Brown --- send-stream.c | 2 +- 1 file

Re: [PATCH 00/15] xfstests: new btrfs stress test cases

2014-08-21 Thread Zach Brown
> It's trivial to write this as a bunch of helper functions and then > boiler-plate the actual tests themselves. There will be little > difference in terms of run time, but we get much more fine-grained > control of execution and reporting Sure, that's reasonable, given the xfstests infrastruc

Re: [PATCH 00/15] xfstests: new btrfs stress test cases

2014-08-20 Thread Zach Brown
On Thu, Aug 21, 2014 at 01:33:48AM +0800, Eryu Guan wrote: > This patchset add new stress test cases for btrfs by running two > different btrfs operations simultaneously under fsstress to ensure > btrfs doesn't hang or oops in such situations. btrfs scrub and > btrfs check will be run after each te

Re: btrfs receive problem on ARM kirkwood NAS with kernel 3.16.0 and btrfs-progs 3.14.2

2014-08-19 Thread Zach Brown
On Sun, Aug 17, 2014 at 02:44:34PM +0200, Klaus Holler wrote: > Hello list, > > I want to use an ARM kirkwood based NSA325v2 NAS (dubbed "Receiver") for > receiving btrfs snapshots done on several hosts, e.g. a Core Duo laptop > running kubuntu 14.04 LTS (dubbed "Source"), storing them on a 3TB WD

Re: [BUG] cannot mount subvolume with selinux context

2014-08-19 Thread Zach Brown
On Tue, Aug 19, 2014 at 11:32:16AM +0800, Eryu Guan wrote: > Hi, > > Description of the problem: > > mount btrfs with selinux context, then create a subvolume, the new > subvolume cannot be mounted, even with the same context. > > mkfs -t btrfs /dev/sda5 > mount -o context=system_u:object_r:nfs_

Re: [PATCH 1/1] Btrfs: fix sparse warning

2014-08-05 Thread Zach Brown
> > > Hello Zach, > > > > > >     Here's an untested patch which > > > > Try testing it.  It's easy with virtualization and xfstests. > > > > You'll find that sending to a file fails because each individual file > > write call that makes up a send starts at offset 0 -- at the start of > > the file.

Re: [PATCH 03/12] btrfs: handle errors from reading the quota tree root

2014-08-04 Thread Zach Brown
On Mon, Aug 04, 2014 at 01:42:23PM -0500, Eric Sandeen wrote: > On 8/4/14, 1:35 PM, Zach Brown wrote: > > On Fri, Aug 01, 2014 at 06:12:37PM -0500, Eric Sandeen wrote: > >> Reading the quota tree root may fail with ENOENT > >> if there is no quota, which is fine, but

Re: [PATCH 03/12] btrfs: handle errors from reading the quota tree root

2014-08-04 Thread Zach Brown
On Fri, Aug 01, 2014 at 06:12:37PM -0500, Eric Sandeen wrote: > Reading the quota tree root may fail with ENOENT > if there is no quota, which is fine, but the code was > ignoring every other error as well, which is not fine. Kinda makes you want to write a test that would have caught this. Kinda

Re: [PATCH 1/1] Btrfs: fix sparse warning

2014-08-04 Thread Zach Brown
On Sat, Aug 02, 2014 at 02:24:49PM +0200, Fabian Frederick wrote: > On Thu, 17 Jul 2014 12:01:52 -0700 > Zach Brown wrote: > > > > > > @@ -515,7 +515,8 @@ static int write_buf(struct file *filp, const > > > > > void *buf, > > > > > u32

Re: [PATCH] Remove certain calls for releasing page cache

2014-07-30 Thread Zach Brown
On Wed, Jul 30, 2014 at 04:47:12PM -0400, Josef Bacik wrote: > On 07/30/2014 04:42 PM, Nicholas Krause wrote: > >This patch removes the lines for releasing the page cache in certain > >files as this may aid in perfomance with writes in the compression > >rountines of btrfs. Please note that this pa

Re: [PATCH] mkfs.btrfs: round all device sizes to sectorsize

2014-07-25 Thread Zach Brown
On Thu, Jul 24, 2014 at 11:27:32PM -0500, Eric Sandeen wrote: > make_btrfs() rounds down the first device size to a multiple of sectorsize: ^^^ > - device->total_bytes = block_count; > + device->total_bytes = (block_count / sectorsize) * sectorsize; kerncompat.h:#d

Re: feature request: consider rw subvols ro for send when volume is mounted ro

2014-07-23 Thread Zach Brown
On Wed, Jul 23, 2014 at 02:10:29PM -0600, Chris Murphy wrote: > The use case is when it's possible to mount a Btrfs volume ro, but not rw. > Example, a situation where > > # mount -o degraded /dev/sdb /mnt > [ 71.064352] BTRFS info (device sdb): allowing degraded mounts > [ 71.064812] BTRFS i

Re: [PATCH 1/1] Btrfs: fix sparse warning

2014-07-17 Thread Zach Brown
> > > @@ -515,7 +515,8 @@ static int write_buf(struct file *filp, const void > > > *buf, > > > u32 len, loff_t *off) > > > > Though this probably wants to be rewritten in terms of kernel_write(). > > That'd give an opportunity to get rid of the sctx->send_off and have it > > use f_pos in the filp.

[PATCH] btrfs-progs: mkfs: don't zero extend small files

2014-07-16 Thread Zach Brown
the larger questions of whether to modify the device before the size test or whether or zero regions that have been trimmed. Finally, the error handling mess after the zeroing calls is cleaned up. zero_blocks() and its callers only return -errno. Signed-off-by: Zach Brow

Re: [PATCH 1/1] Btrfs: fix sparse warning

2014-07-16 Thread Zach Brown
51:got char * > > We can safely use (const char __user *) with set_fs(KERNEL_DS) Yeah, that cast is correct. Reviewed-by: Zach Brown > @@ -515,7 +515,8 @@ static int write_buf(struct file *filp, const void *buf, > u32 len, loff_t *off) Though this probably wants to be rewritt

Re: [PATCH] xfstests/btrfs: add test for quota groups and drop snapshot

2014-07-10 Thread Zach Brown
On Thu, Jul 10, 2014 at 12:00:55PM -0700, Mark Fasheh wrote: > On Thu, Jul 10, 2014 at 11:32:28AM -0700, Zach Brown wrote: > > On Thu, Jul 10, 2014 at 10:36:14AM -0700, Mark Fasheh wrote: > > > On Thu, Jul 10, 2014 at 10:43:30AM +1000, Dave Chinner wrote: > > > > On W

Re: [PATCH] xfstests/btrfs: add test for quota groups and drop snapshot

2014-07-10 Thread Zach Brown
On Thu, Jul 10, 2014 at 10:36:14AM -0700, Mark Fasheh wrote: > On Thu, Jul 10, 2014 at 10:43:30AM +1000, Dave Chinner wrote: > > On Wed, Jul 09, 2014 at 03:41:50PM -0700, Mark Fasheh wrote: > > > + > > > +# Enable qgroups now that we have our filesystem prepared. This > > > +# will kick off a scan

Re: [PATCH] generic/017: skip invalid block sizes for btrfs

2014-06-23 Thread Zach Brown
On Mon, Jun 23, 2014 at 11:28:00AM +0100, Filipe David Borba Manana wrote: > In btrfs the block size (called sector size in btrfs) can not be > smaller then the page size. Nor larger. commit 8d082fb727ac11930ea20bf1612e334ea7c2b697 Author: Liu Bo Date: Tue Apr 3 09:56:53 2012 +0800 Btrfs:

Re: [PATCH 1/3] btrfs: return errno instead of -1 from compression

2014-05-09 Thread Zach Brown
On Fri, May 09, 2014 at 03:39:26PM +0200, David Sterba wrote: > On Thu, May 08, 2014 at 07:16:17PM -0400, Zach Brown wrote: > > The compression layer seems to have been built to return -1 and have > > callers make up errors that make sense. This isn't great because there >

[PATCH v2 3/3] btrfs: fix inline compressed read err corruption

2014-05-09 Thread Zach Brown
n the error from btrfs_decompress() but not from the allocation error a few lines above. So the page zeroing is removed. Signed-off-by: Zach Brown Reviewed-by: David Sterba --- fs/btrfs/inode.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/inode.c b/

[PATCH v2 1/3] btrfs: return errno instead of -1 from compression

2014-05-09 Thread Zach Brown
an pass on the error without having to guess what happened. ENOMEM for allocation failure, E2BIG when compression exceeds the uncompressed input, and EIO for everything else. This helps a future path return errors from btrfs_decompress(). Signed-off-by: Zach Brown --- fs/btrfs/l

[PATCH v2 2/3] btrfs: return ptr error from compression workspace

2014-05-09 Thread Zach Brown
wrappers. Signed-off-by: Zach Brown Reviewed-by: David Sterba --- fs/btrfs/compression.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index ed1ff1cb..7912695 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs

Re: [PATCH] Btrfs: add a extent ref verify tool V2

2014-05-09 Thread Zach Brown
On Fri, May 09, 2014 at 04:45:05PM -0400, Josef Bacik wrote: > On 05/08/2014 07:34 PM, Zach Brown wrote: > >>+#ifdef CONFIG_BTRFS_FS_REF_VERIFY > >>+int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info); > >>+void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info

Re: [PATCH 3/3] btrfs: fix inline compressed read err corruption

2014-05-09 Thread Zach Brown
On Fri, May 09, 2014 at 03:58:00PM +0200, David Sterba wrote: > On Thu, May 08, 2014 at 07:16:19PM -0400, Zach Brown wrote: > > uncompress_inline() is silently dropping an error from > > btrfs_decompress() after testing it and zeroing the page that was > > supposed to hold dec

Re: [PATCH] Btrfs: add a extent ref verify tool V2

2014-05-08 Thread Zach Brown
> +#ifdef CONFIG_BTRFS_FS_REF_VERIFY > +int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info); > +void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info); > +int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr, u64 num_bytes, > +u64 parent, u64 ref_root, u64 owner, u64

[PATCH 1/3] btrfs: return errno instead of -1 from compression

2014-05-08 Thread Zach Brown
7;s return real negative errnos from the compression layer so that callers can pass on the error without having to guess what happened. This helps a future path return errors from btrfs_decompress(). Signed-off-by: Zach Brown --- fs/btrfs/lzo.c | 14 +++--- fs/btrfs/z

[PATCH 3/3] btrfs: fix inline compressed read err corruption

2014-05-08 Thread Zach Brown
$(which od) /tmp/failod # /tmp/failod -x /mnt/btrfs/dir/80 | head -1 000 Signed-off-by: Zach Brown --- fs/btrfs/inode.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0c0bb45..fc89fa7

[PATCH 2/3] btrfs: return ptr error from compression workspace

2014-05-08 Thread Zach Brown
wrappers. Signed-off-by: Zach Brown --- fs/btrfs/compression.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index ed1ff1cb..7912695 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -888,7 +888,7 @@ int

Re: [PATCH 00/27] Replace the old man page with asciidoc and man page for each btrfs subcommand.

2014-04-03 Thread Zach Brown
On Wed, Apr 02, 2014 at 09:24:10AM -0400, Chris Mason wrote: > On 04/02/2014 04:29 AM, Qu Wenruo wrote: > >Convert the old btrfs man pages to new asciidoc and split the huge > >btrfs man page into subcommand man page. > > > >The asciidoc style and Makefile things are mostly simplified from git > >D

Re: Building a brtfs filesystem < 70M?

2014-03-11 Thread Zach Brown
> There seems to be an issue if we try to build a btrfs based FS that > is less than 70M, we get the following assertion failure: > > mkfs.btrfs: extent-tree.c:2682: btrfs_reserve_extent: Assertion > `!(ret)' failed. > mkfs.btrfs -b 104857600 -r rootfs rootfs.btrfs Honestly, the path of least re

Re: [PATCH] Btrfs: fix deadlock with nested trans handles

2014-03-06 Thread Zach Brown
ill let us get rid of the trans->use_count++ hack if we have to > commit > the transaction. Thanks, And this fixes it. It's run through a few times successfully. > cc: sta...@vger.kernel.org > Reported-by: Zach Brown > Signed-off-by: Josef Bacik Tested-by: Zach Brown - z

Re: [PATCH 01/13] btrfs: add ioctls to query/change feature bits online

2013-11-01 Thread Zach Brown
> +static int btrfs_ioctl_get_supported_features(struct file *file, > + void __user *arg) > +{ > + struct btrfs_ioctl_feature_flags features[3]; > + > + features[0].compat_flags = BTRFS_FEATURE_COMPAT_SUPP; > + features[0].compat_ro_flags = BTRF

Re: [PATCH] btrfs: add framework to read fs info from btrfs-control

2013-10-29 Thread Zach Brown
> This adds ioctl BTRFS_IOC_GET_FSIDS which reads the fs > info through the btrfs-control Why not use sysfs? > + sz_fslist_arg = sizeof(*fslist_arg); > + fslist_arg = memdup_user(arg, sz_fslist_arg); Doesn't check allocation failure. > + > + sz_fslist = sizeof(*fslist) * fslist_arg

Re: [PATCH] Btrfs: stop using vfs_read in send

2013-10-29 Thread Zach Brown
Sorry for the latency. I was away last week. On Fri, Oct 25, 2013 at 11:37:53AM -0400, Josef Bacik wrote: > Apparently we don't actually close the files until we return to userspace, so > stop using vfs_read in send. This is actually better for us since we can > avoid > all the extra logic of h

Re: btrfs send 'leaks' open files

2013-10-22 Thread Zach Brown
On Tue, Oct 22, 2013 at 06:22:49PM +0100, Al Viro wrote: > On Sun, Oct 20, 2013 at 11:33:56AM +0100, Phil Davis wrote: > > > The reason I think btrfs send is leaking open files is if you watch > > /proc/sys/fs/file-nr you see the > > number of open files increasing but if you kill the btrfs send

Re: [PATCH] Btrfs: fix up seek_hole/seek_data handling

2013-10-18 Thread Zach Brown
On Fri, Oct 18, 2013 at 10:11:15PM +0600, Roman Mamedov wrote: > On Fri, 18 Oct 2013 11:48:21 -0400 > Josef Bacik wrote: > > > Whoever wrote this was braindead. > > You do realize you sent a number of people googling for "Delalloc is such a > pain. If we have a hole and we have pending" just out

[PATCH 3/3] btrfs: remove fs/btrfs/compat.h

2013-10-16 Thread Zach Brown
fs/btrfs/compat.h only contained trivial macro wrappers of drop_nlink() and inc_nlink(). This doesn't belong in mainline. Signed-off-by: Zach Brown --- fs/btrfs/compat.h | 7 --- fs/btrfs/compression.c | 1 - fs/btrfs/dev-replace.c | 1 - fs/btrfs/disk-io.c | 1 - fs/

[PATCH 1/3] btrfs: use get_seconds() instead of btrfs wrapper

2013-10-16 Thread Zach Brown
Signed-off-by: Zach Brown --- fs/btrfs/dev-replace.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 2a9bd5b..d3ee6e7 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -38,7 +38,6

[PATCH 2/3] btrfs: remove move_pages()

2013-10-16 Thread Zach Brown
e test for overlapping page regions. So remove move_pages() and just call copy_pages(). Signed-off-by: Zach Brown --- fs/btrfs/extent_io.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index c10291c..46a4022 10064

trivial cleanups

2013-10-16 Thread Zach Brown
Hi gang, Here's some trivial cleanups that I've built up while reading through the code. They've been run through xfstests -g quick. - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://

Re: [PATCH] Btrfs: stop all workers after we free block groups

2013-10-16 Thread Zach Brown
On Wed, Oct 16, 2013 at 01:56:50PM -0400, Josef Bacik wrote: > Stefan was hitting a panic in the async worker stuff because we had > outstanding > read bios while we were stopping the worker threads. > fs/btrfs/disk-io.c | 4 ++-- Seems like a nice candidate for stable@, no? - z -- To unsubscri

Re: [PATCH] Btrfs: Don't allocate inode that is already in use

2013-10-16 Thread Zach Brown
> > Don't just skip regression testing. Please. > > You are mixing up my points. The first argument you're quoting is not against > regression testing in this case, and it deserves the "stress" answer, I agree. Great, then we're done. (Yes, I'm very much ignoring your other argument that's base

Re: [PATCH] Btrfs: Don't allocate inode that is already in use

2013-10-15 Thread Zach Brown
> Probably a bit too obscure to turn this into an xfstest? At least nobody > complained so far, and this reproducer takes me 1m57 to run, so nothing I want > in each xfstest cycle. I disagree. The entire point of regression tests is to trigger bugs that the usual processes failed to find, like t

Re: [PATCH] Btrfs: init device stats for new devices

2013-10-11 Thread Zach Brown
> a filesystem is mounted. They set the device stats to zero by using > kzalloc() which is correct for new devices. Oh, right, got it :) - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http

Re: [PATCH] Btrfs: init device stats for new devices

2013-10-11 Thread Zach Brown
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > index 646d10d..9837439 100644 > --- a/fs/btrfs/volumes.c > +++ b/fs/btrfs/volumes.c > @@ -2041,6 +2041,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char > *device_path) > device->in_fs_metadata = 1; > device->is_tgtdev

Re: [PATCH] Btrfs: use right root when checking for hash collision

2013-10-09 Thread Zach Brown
trying to move > in its current root. This fixes the bug where this would fail > > btrfs subvol create test1 > btrfs subvol create test2 > mv test1 test2. > > Thanks to Chris Murphy for catching this, > > Reported-by: Chris Murphy > Signed-off-by: Josef Bacik Look

Re: regression, can't move subvols into subvols

2013-10-08 Thread Zach Brown
On Tue, Oct 08, 2013 at 03:58:23PM -0600, Chris Murphy wrote: > I don't think this is expected, is it? I can no longer move a > subvolume into another subvolume. I can move a subvolume into a > directory. This happens with 3.11.3, and 3.12 rc4. I'm not sure yet > when the regression first appeared.

Re: [RFC] another round of static analysis fixes

2013-10-08 Thread Zach Brown
> Compile-tested! Cool, thanks! > [02/12] not merged, [08/12] replaces chandan's commit I just sent another attempt at 02/ :). - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.

Re: [PATCH 02/12] btrfs-progs: check fopen failure in cmds-send

2013-10-08 Thread Zach Brown
> close() can modify errno. > > And close(fd) is already called 4 lines above. You didn't run the static > code analysis again after applying your patch :) OK, here's a less dumb attempt: - z >From f8a3425c184a55e0c254143e520e60a6856c27da Mon Sep 17 00:00:00 2001 From:

Re: [PATCH 02/12] btrfs-progs: check fopen failure in cmds-send

2013-10-08 Thread Zach Brown
> And close(fd) is already called 4 lines above. You didn't run the static > code analysis again after applying your patch :) Nice, thanks for catching that. I certainly didn't run it again, no :). - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a mes

Re: [PATCH 09/12] btrfs-progs: don't deref pipefd[-1]

2013-10-07 Thread Zach Brown
On Mon, Oct 07, 2013 at 04:45:01PM -0500, Eric Sandeen wrote: > On 10/7/13 4:43 PM, Zach Brown wrote: > > commit 4782e8ebdb583dfa3615f7b38dee729d34f62ec1 accidentally replaced > > [0] with [-1]. Put it back. This was found by static analysis. > > > > Signed-off-by:

Re: [PATCH] Btrfs: remove unnecessary key copy when logging inode

2013-10-07 Thread Zach Brown
On Mon, Oct 07, 2013 at 09:20:44PM +0100, Filipe David Borba Manana wrote: > The btrfs_insert_empty_item() function doesn't modify its > key argument. Looks reasonable to me. Reviewed-by: Zach Brown - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs&q

[PATCH 04/12] btrfs-progs: don't overflow read buffer in image

2013-10-07 Thread Zach Brown
search_for_chunk_blocks() allocates a fixed-size buffer and then reads arbitrary u32 sized buffers in to it. Instead let's fail if the item is bigger than the buffer. This was found by static analysis. Signed-off-by: Zach Brown --- btrfs-image.c | 14 +++--- 1 file change

[PATCH 03/12] btrfs-progs: don't overrun name in find-collisions

2013-10-07 Thread Zach Brown
find_collision() allocates name_len bytes for its sub array so the index must be less than name_len. This was found by static analysis. Signed-off-by: Zach Brown --- btrfs-image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btrfs-image.c b/btrfs-image.c index

[PATCH 07/12] btrfs-progs: free eb in fixup_chunk_tree_block()

2013-10-07 Thread Zach Brown
This was found by static analysis. Signed-off-by: Zach Brown --- btrfs-image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-image.c b/btrfs-image.c index 03ad4e9..d10447f 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -1541,6 +1541,7 @@ next: bytenr += mdres

[PATCH 05/12] btrfs-progs: check link_subvol name base

2013-10-07 Thread Zach Brown
: Zach Brown --- btrfs-convert.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/btrfs-convert.c b/btrfs-convert.c index 221dd45..edef1bd 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -1428,10 +1428,15 @@ static struct btrfs_root * link_subvol

[PATCH 06/12] btrfs-progs: remove dead block group checking

2013-10-07 Thread Zach Brown
Don't carry around dead code. If its needed again, it's only a few git commands away. This was found by static analysis. Signed-off-by: Zach Brown --- cmds-check.c | 50 -- 1 file changed, 50 deletions(-) diff --git a/cmds-chec

[PATCH 08/12] btrfs-progs: don't leak path in verify_space_cache

2013-10-07 Thread Zach Brown
This was found by static analysis. Signed-off-by: Zach Brown --- cmds-check.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index ebba58e..b6035d7 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3228,13 +3228,13 @@ static int

[PATCH 11/12] btrfs-progs: remove unused variables

2013-10-07 Thread Zach Brown
Presumably people missed these warnings because btrfs-fragments isn't built by default. Signed-off-by: Zach Brown --- btrfs-fragments.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/btrfs-fragments.c b/btrfs-fragments.c index cedbc57..160429a 100644 --- a/btrfs-fragments.c

[PATCH 10/12] btrfs-progs: don't overflow colors[] in fragments

2013-10-07 Thread Zach Brown
Stop iteration at the number of elements in the colors[] array when initializing the elements. Rather than a magic number. This was found by static analysis. Signed-off-by: Zach Brown --- btrfs-fragments.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrfs-fragments.c b

[PATCH 09/12] btrfs-progs: don't deref pipefd[-1]

2013-10-07 Thread Zach Brown
commit 4782e8ebdb583dfa3615f7b38dee729d34f62ec1 accidentally replaced [0] with [-1]. Put it back. This was found by static analysis. Signed-off-by: Zach Brown --- send-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/send-test.c b/send-test.c index 3775f5f..a37b7fd

[PATCH 12/12] btrfs-progs: free leaked roots in calc-size

2013-10-07 Thread Zach Brown
This was found by static analysis. Signed-off-by: Zach Brown --- btrfs-calc-size.c | 1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-calc-size.c b/btrfs-calc-size.c index 5aa0b70..38b70d9 100644 --- a/btrfs-calc-size.c +++ b/btrfs-calc-size.c @@ -257,5 +257,6 @@ int main(int argc, char

  1   2   3   4   >