Re: [PATCH v2] Btrfs: extended inode refs support for send mechanism

2012-10-16 Thread Mark Fasheh
trfs/send.c| 126 > +--- > 3 files changed, 94 insertions(+), 58 deletions(-) > --- > Changes for v2: > - Re-understood how btrfs_search_slot_for_read works (3 places, reported > by Alex Lyakas) > - Fixed extref handling in get_first_ref (reported by Mark

Re: [PATCH] Btrfs: extended inode refs support for send mechanism

2012-10-11 Thread Mark Fasheh
(unsigned long)&extref->name, len); > + } > if (ret < 0) > goto out; > btrfs_release_path(path); Ok there's the following line in get_first_ref() which I believe was missed: *dir = found_key.offset; that will have to accoun

Re: [PATCH v4 3/4] btrfs: extended inode refs

2012-10-09 Thread Mark Fasheh
3e6436869838 ... > > On Mon, August 20, 2012 at 22:29 (+0200), Mark Fasheh wrote: > > Teach tree-log.c about extended inode refs. In particular, we have to adjust > > the behavior of inode ref replay as well as log tree recovery to account for > > the existence o

Re: [PATCH v4 0/4] btrfs: extended inode refs

2012-09-27 Thread Mark Fasheh
On Tue, Sep 25, 2012 at 04:04:46PM -0400, Chris Mason wrote: > On Mon, Aug 20, 2012 at 02:29:17PM -0600, Mark Fasheh wrote: > > > > Testing wise, the basic namespace operations work well (link, unlink, etc). > > The rest has gotten less debugging (and I really don&

[PATCH v4 4/4] btrfs: extended inode refs

2012-08-20 Thread Mark Fasheh
. Reviewed-by: Jan Schmidt Signed-off-by: Mark Fasheh --- fs/btrfs/backref.c | 134 +++- fs/btrfs/backref.h |2 - 2 files changed, 112 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 658e09c..4a01f7c 100644

[PATCH v4 2/4] btrfs: improved readablity for add_inode_ref

2012-08-20 Thread Mark Fasheh
From: Jan Schmidt Moved part of the code into a sub function and replaced most of the gotos by ifs, hoping that it will be easier to read now. Signed-off-by: Jan Schmidt Signed-off-by: Mark Fasheh --- fs/btrfs/tree-log.c | 178 --- 1 files

[PATCH v4 1/4] btrfs: extended inode refs

2012-08-20 Thread Mark Fasheh
This patch adds basic support for extended inode refs. This includes support for link and unlink of the refs, which basically gets us support for rename as well. Inode creation does not need changing - extended refs are only added after the ref array is full. Signed-off-by: Mark Fasheh --- fs

[PATCH v4 3/4] btrfs: extended inode refs

2012-08-20 Thread Mark Fasheh
Teach tree-log.c about extended inode refs. In particular, we have to adjust the behavior of inode ref replay as well as log tree recovery to account for the existence of extended refs. Signed-off-by: Mark Fasheh --- fs/btrfs/backref.c | 68 +++ fs/btrfs/backref.h |5 + fs/btrfs

[PATCH v4 0/4] btrfs: extended inode refs

2012-08-20 Thread Mark Fasheh
kref.c changes - Instead of adding a second iterate function for extended refs, I fixed up iterate_irefs_t arguments to take the raw information from whatever ref version we're coming from. This removed a bunch of duplicated code. - I am actually including a patch to btrfs-progs with t

Re: [PATCH 2/3] btrfs: extended inode refs

2012-08-15 Thread Mark Fasheh
On Wed, Aug 15, 2012 at 05:04:48PM +0200, Jan Schmidt wrote: > When applying this patch I get: > > warning: 2 lines add whitespace errors. > Oop, I'll fix that up. > More comments inline. > > On Wed, August 08, 2012 at 20:55 (+0200), Mark Fasheh wrote: > >

Re: [PATCH 1/3] btrfs: extended inode refs

2012-08-14 Thread Mark Fasheh
On Tue, Aug 14, 2012 at 11:32:43AM +0200, Jan Schmidt wrote: > On Wed, August 08, 2012 at 20:55 (+0200), Mark Fasheh wrote: > > +/* > > + * btrfs_insert_inode_extref() - Inserts an extended inode ref into a tree. > > + * > > + * The caller must have checked aga

[PATCH 2/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
Teach tree-log.c about extended inode refs. In particular, we have to adjust the behavior of inode ref replay as well as log tree recovery to account for the existence of extended refs. Signed-off-by: Mark Fasheh --- fs/btrfs/backref.c | 68 fs/btrfs/backref.h |5 + fs

[PATCH 3/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
-off-by: Mark Fasheh --- fs/btrfs/backref.c | 134 +++- fs/btrfs/backref.h |2 - 2 files changed, 112 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 658e09c..4a01f7c 100644 --- a/fs/btrfs/backref.c

[PATCH 1/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
This patch adds basic support for extended inode refs. This includes support for link and unlink of the refs, which basically gets us support for rename as well. Inode creation does not need changing - extended refs are only added after the ref array is full. Signed-off-by: Mark Fasheh --- fs

[PATCH 0/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
fs, I fixed up iterate_irefs_t arguments to take the raw information from whatever ref version we're coming from. This removed a bunch of duplicated code. - I am actually including a patch to btrfs-progs with this drop. :) From: Mark Fasheh [PATCH] btrfs-progs: basic support for exte

Re: [PATCH 2/3] btrfs: extended inode refs

2012-08-06 Thread Mark Fasheh
On Fri, Jul 06, 2012 at 04:57:15PM +0200, Jan Schmidt wrote: > Thought about this search_done once again, I'd like to repeat our May's > conversation: > > On Fri, May 04, 2012 at 01:12 (+0200), Mark Fasheh wrote: > > > You moved this comment and assignment

Re: [PATCH 1/3] btrfs: extended inode refs

2012-07-09 Thread Mark Fasheh
return 1; > > + } > > + > > + cur_offset += ref_name_len + sizeof(*extref); > > + } > > + return 0; > > For consistency, I'd like to switch return 0 and 1. Ok so btrfs_find_name_in_ext_backref() is designed to mirr

Re: [PATCH 3/3] btrfs: extended inode refs

2012-07-09 Thread Mark Fasheh
On Fri, Jul 06, 2012 at 04:57:29PM +0200, Jan Schmidt wrote: > On Mon, May 21, 2012 at 23:46 (+0200), Mark Fasheh wrote: > > From: Mark Fasheh > > > > The iterate_irefs in backref.c is used to build path components from inode > > refs. This patch adds code to it

Re: [PATCH 1/3] btrfs: extended inode refs

2012-07-09 Thread Mark Fasheh
d up for an updated patch (don't think I need to reply individually to those). > On Mon, May 21, 2012 at 23:46 (+0200), Mark Fasheh wrote: > > @@ -189,6 +435,19 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle > > *trans, > > > > out: > >

[PATCH 3/3] [PATCH] btrfs-progs: mkfs support for extended inode refs

2012-06-07 Thread Mark Fasheh
From: Mark Fasheh This patch turns on the BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF superblock flag when creating a new file system in mkfs, enabling extended inode refs. Signed-off-by: Mark Fasheh --- mkfs.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a

[PATCH 2/3] [PATCH] btrfs-progs: add extended inode ref support to btrfsck

2012-06-07 Thread Mark Fasheh
From: Mark Fasheh Add a function, process_inode_extref() to be called from process_one_leaf() when an item type of BTRFS_INODE_EXTREF_KEY is encountered. Similarly to process_inode_ref(), process_inode_extref() walks an extref and adds an inode_backref structure for each reference found within

[PATCH 1/3] [PATCH] btrfs-progs: Basic support for extended inode refs

2012-06-07 Thread Mark Fasheh
From: Mark Fasheh This patch syncs the extended inode ref definitions from kernels ctree.h and adds support in btrfs-debug-tree for visualizing the state of extended refs on disk. Signed-off-by: Mark Fasheh --- ctree.h | 27 ++- print-tree.c | 44

[PATCH 0/3] btrfs-progs: Support for extended inode refs

2012-06-07 Thread Mark Fasheh
hash collision by storing items with the same key in an array just like the dir item code. This means we have to search an array on rare occasion. -- Mark Fasheh -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.

[PATCH 2/3] btrfs: extended inode refs

2012-05-21 Thread Mark Fasheh
From: Mark Fasheh Teach tree-log.c about extended inode refs. In particular, we have to adjust the behavior of inode ref replay as well as log tree recovery to account for the existence of extended refs. Signed-off-by: Mark Fasheh --- fs/btrfs/backref.c | 68 +++ fs/btrfs/backref.h

[PATCH 3/3] btrfs: extended inode refs

2012-05-21 Thread Mark Fasheh
From: Mark Fasheh The iterate_irefs in backref.c is used to build path components from inode refs. This patch adds code to iterate extended refs as well. I had modify the callback function signature to abstract out some of the differences between ref structures. iref_to_path() also needed

[PATCH 1/3] btrfs: extended inode refs

2012-05-21 Thread Mark Fasheh
From: Mark Fasheh This patch adds basic support for extended inode refs. This includes support for link and unlink of the refs, which basically gets us support for rename as well. Inode creation does not need changing - extended refs are only added after the ref array is full. Signed-off-by

[PATCH 0/3] btrfs: extended inode refs

2012-05-21 Thread Mark Fasheh
the backref.c changes - Instead of adding a second iterate function for extended refs, I fixed up iterate_irefs_t arguments to take the raw information from whatever ref version we're coming from. This removed a bunch of duplicated code. - I am actually including a patch to btrfs-progs with

Re: [PATCH 3/3] btrfs: extended inode refs

2012-05-08 Thread Mark Fasheh
those callbacks needed from the ref. > > + if (ret) { > > + free_extent_buffer(eb); > > + break; > > + } > > + > > + free_extent_buffer(eb); > > Call free_extent_buffer(eb) before the if (ret), drop it f

Re: [PATCH 2/3] btrfs: extended inode refs

2012-05-03 Thread Mark Fasheh
On Thu, Apr 12, 2012 at 03:08:35PM +0200, Jan Schmidt wrote: > On 05.04.2012 22:09, Mark Fasheh wrote: > > Teach tree-log.c about extended inode refs. In particular, we have to adjust > > the behavior of inode ref replay as well as log tree recovery to account for > > the

Re: [PATCH 2/3] btrfs: extended inode refs

2012-05-01 Thread Mark Fasheh
On Thu, Apr 12, 2012 at 05:53:15PM +0200, Jan Schmidt wrote: > Hi Mark, > > While reading 3/3 I stumbled across one more thing in this one: > > On 05.04.2012 22:09, Mark Fasheh wrote: > > +int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid, > >

Re: [PATCH 1/3] btrfs: extended inode refs

2012-04-24 Thread Mark Fasheh
path); > > > > - ref = btrfs_lookup_inode_ref(trans, root, path, > > - dentry->d_name.name, dentry->d_name.len, > > - ino, dir_ino, 0); > > - if (IS_ERR(ref)) { > > - err = PTR_ERR(ref); > > + ret = btrfs_get_inode_ref_index(trans, root, path, dentry->d_name.name, > > + dentry->d_name.len, ino, dir_ino, 0, > > &index); > > This line is >80 chars. Please use scripts/checkpatch.pl to catch those. Fixed. > > + if (ret) { > > + err = ret; > > goto out; > > } > > - BUG_ON(!ref); > > + > > if (check_path_shared(root, path)) > > goto out; > > - index = btrfs_inode_ref_index(path->nodes[0], ref); > > + > > btrfs_release_path(path); > > > > /* > > @@ -4484,6 +4482,10 @@ static struct inode *btrfs_new_inode(struct > > btrfs_trans_handle *trans, > > btrfs_set_key_type(&key[0], BTRFS_INODE_ITEM_KEY); > > key[0].offset = 0; > > > > + /* > > +* Start new inodes with a V1 ref. This is slightly more > > +* efficient for small numbers of hard links. > > +*/ > > I'd drop that comment. extref is no "V2" kind of ref. But you can leave > it in if you feel it helps anyone later. Yeah at one point they were called 'v2' due to developer laziness :) I've updated the comment: /* * Start new inodes with an inode_ref. This is slightly more * efficient for small numbers of hard links since they will * be packed into one item. Extended refs will kick in if we * add more hard links than can fit in the ref item. */ It could probably still be improved beyond that. Mostly I want to point out that we never start with extended refs so that anyone looking at the code will understand the 'flow' of btrfs inode references. > > key[1].objectid = objectid; > > btrfs_set_key_type(&key[1], BTRFS_INODE_REF_KEY); > > key[1].offset = ref_objectid; > > @@ -4777,7 +4779,7 @@ static int btrfs_link(struct dentry *old_dentry, > > struct inode *dir, > > if (root->objectid != BTRFS_I(inode)->root->objectid) > > return -EXDEV; > > > > - if (inode->i_nlink == ~0U) > > + if (inode->i_nlink >= BTRFS_LINK_MAX) > > return -EMLINK; > > > > err = btrfs_set_inode_index(dir, &index); > > Reviewed-by: Jan Schmidt Thanks again Jan. I'll be sure to CC you on my next drop! --Mark -- Mark Fasheh -- 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 0/3] btrfs: extended inode refs

2012-04-12 Thread Mark Fasheh
aving > to search around inside the item. Yeah this actually turns out to be a bit easier to code as well. I'm taking this approach. --Mark -- Mark Fasheh -- 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

[PATCH 3/3] btrfs: extended inode refs

2012-04-05 Thread Mark Fasheh
differences in the two disk structures. Signed-off-by: Mark Fasheh --- fs/btrfs/backref.c | 200 ++-- fs/btrfs/backref.h |4 +- 2 files changed, 165 insertions(+), 39 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 0436c12

[PATCH 2/3] btrfs: extended inode refs

2012-04-05 Thread Mark Fasheh
Teach tree-log.c about extended inode refs. In particular, we have to adjust the behavior of inode ref replay as well as log tree recovery to account for the existence of extended refs. Signed-off-by: Mark Fasheh --- fs/btrfs/tree-log.c | 320

[PATCH 1/3] btrfs: extended inode refs

2012-04-05 Thread Mark Fasheh
This patch adds basic support for extended inode refs. This includes support for link and unlink of the refs, which basically gets us support for rename as well. Inode creation does not need changing - extended refs are only added after the ref array is full. Signed-off-by: Mark Fasheh --- fs

[PATCH 0/3] btrfs: extended inode refs

2012-04-05 Thread Mark Fasheh
Currently btrfs has a limitation on the maximum number of hard links an inode can have. Specifically, links are stored in an array of ref items: struct btrfs_inode_ref { __le64 index; __le16 name_len; /* name goes here */ } __attribute__ ((__packed__)); The ref arrays are

Re: [Cluster-devel] fallocate vs O_(D)SYNC

2011-11-16 Thread Mark Fasheh
On Wed, Nov 16, 2011 at 11:35:40AM -0800, Mark Fasheh wrote: > > We should do it per FS though, I'll patch up btrfs. > > I agree about doing it per FS. Ocfs2 just needs a one-liner to mark the > journal transaction as synchronous. Joel, here's an (untested) p

Re: [Cluster-devel] fallocate vs O_(D)SYNC

2011-11-16 Thread Mark Fasheh
mpletely > > transparent to userspace. > > We should do it per FS though, I'll patch up btrfs. I agree about doing it per FS. Ocfs2 just needs a one-liner to mark the journal transaction as synchronous. --Mark -- Mark Fasheh -- 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: [RFC][PATCH 1/2] vfs: allow /proc/pid/maps to return a custom device

2011-10-07 Thread Mark Fasheh
a far greater degree than just allowing an optional deref of whatever structure btrfs (and similar file systems) have to point to the right block device. Is this really the way we would like to proceed? Chris, maybe you can chime in here? --Mark On Thu, May 19, 2011 at 01:18:26PM -0700, Mark F

[PATCH 05/20] btrfs: Don't BUG_ON errors in __finish_chunk_alloc()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh All callers of __finish_chunk_alloc() BUG_ON() return value, so it's trivial for us to always bubble up any errors caught in __finish_chunk_alloc() to be caught there. Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |7 ++- 1 files changed, 2 insertions(

[PATCH 09/20] btrfs: Don't BUG_ON failures in find_and_setup_root()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh This is very easy - we can just pass an error from btrfs_find_last_root() back out to the callers - all of them have proper error handling. Signed-off-by: Mark Fasheh --- fs/btrfs/disk-io.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/btrfs

[PATCH 07/20] btrfs: make fixup_low_keys() void

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh This is trivial - fixup_low_keys always returns zero so we can make it void. As a result, we can then make setup_items_for_insert() void too which lets us cut out a couple of BUG_ON(ret) lines. Signed-off-by: Mark Fasheh --- fs/btrfs/ctree.c | 59

[PATCH 12/20] btrfs: Don't BUG_ON errors from update_ref_for_cow()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh __btrfs_cow_block(), the only caller of update_ref_for_cow() will BUG_ON() any error return. Instead, we can go read-only fs as update_ref_for_cow() manipulates disk data in a way which doesn't look like it's easily rolled back. Signed-off-by: Mark Fasheh ---

[PATCH 13/20] btrfs: Go readonly on tree errors in balance_level

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh balace_level() seems to deal with missing tree nodes by BUG_ON(). Instead, we can easily just set the file system readonly and bubble -EROFS back up the stack. Signed-off-by: Mark Fasheh --- fs/btrfs/ctree.c | 13 +++-- 1 files changed, 11 insertions(+), 2

[PATCH 11/20] btrfs: Go readonly on bad extent refs in update_ref_for_cow()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh update_ref_for_cow() will BUG_ON() after it's call to btrfs_lookup_extent_info() if no existing references are found. Since refs are computed directly from disk, this should be treated as a corruption instead of a logic error. Signed-off-by: Mark Fasheh --- fs/btrfs/ct

[PATCH 03/20] btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh Unfortunately it isn't enough to just exit here - the kzalloc() happens in a loop and the allocated items are added to a linked list whose head is passed in from the caller. To fix the BUG_ON() and also provide the semantic that the list passed in is only modified on su

[PATCH 17/20] btrfs: make add_delayed_tree_ref() void

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh add_delayed_tree_ref() unconditionally returns 0. This makes it trivial to turn into a void function. This kills another BUG_ON(). Signed-off-by: Mark Fasheh --- fs/btrfs/delayed-ref.c | 16 +++- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/fs

[PATCH 19/20] btrfs: Remove BUG_ON from __btrfs_alloc_chunk()

2011-09-15 Thread Mark Fasheh
We BUG_ON() error from add_extent_mapping(), but that error looks pretty easy to bubble back up - as far as I can tell there have not been any permanent modifications to fs state at that point. Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |3 ++- 1 files changed, 2 insertions(+), 1

[PATCH 16/20] btrfs: make add_delayed_ref_head() void

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh This is trivial as the function always returns success. We can remove 3 BUG_ON(ret) lines as a result. Signed-off-by: Mark Fasheh --- fs/btrfs/delayed-ref.c | 26 ++ 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/delayed

[PATCH 20/20] btrfs: Remove BUG_ON from __finish_chunk_alloc()

2011-09-15 Thread Mark Fasheh
btrfs_alloc_chunk() unconditionally BUGs on any error returned from __finish_chunk_alloc() so there's no need for two BUG_ON lines. Remove the one from __finish_chunk_alloc(). Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)

[PATCH 18/20] btrfs: Don't BUG_ON insert errors in btrfs_alloc_dev_extent()

2011-09-15 Thread Mark Fasheh
The only caller of btrfs_alloc_dev_extent() is __btrfs_alloc_chunk() which already bugs on any error returned. We can remove the BUG_ON's in btrfs_alloc_dev_extent() then since __btrfs_alloc_chunk() will "catch" them anyway. Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |

[PATCH 15/20] btrfs: Go readonly on missing ref in btrfs_get_parent()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh btrfs_get_parent() searches the btree for a ref to the current object. From there it can compute the parent objectid from which it can return a dentry. if the reference is not found in the tree however, we BUG(). I believe a more appropriate response would be to go read-only as

[PATCH 14/20] btrfs: Document BUG() in find_lock_delalloc_range()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh We BUG_ON a nonzero, non -EAGAIN ret from lock_delalloc_range(). As it turns out there is no other possible return value that makes sense anyway. The bare BUG_ON(ret) was a bit confusing and looked like something that needed fixing. This patch documents the BUG_ON() so we know

[PATCH 10/20] btrfs: go readonly on insert error in btrfs_add_root_ref()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh In btrfs_add_root_ref() we BUG if an error is encountered during REF/BACKREF insertion. This does not look like a logic error, thus the BUG is not called for. However, I don't think there's a simple way to recover from such an error at that point, so we mark the f

[PATCH 08/20] btrfs: make del_ptr() and btrfs_del_leaf() void

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh Since fixup_low_keys() has been made void, del_ptr() always returns zero. We can then make it void as well. This allows us in turn to make btrfs_del_leaf() void as the only return value it was previously catching was from del_ptr(). This winds up removing a couple of un-needed

[PATCH 06/20] btrfs: fix error check of btrfs_lookup_dentry()

2011-09-15 Thread Mark Fasheh
) which is not really needed - there seems less harm in returning ENOENT to userspace at that point in the stack than there is to crash the machine. Mark: Fixed conflicts against latest tree, gave the patch a more thorough description. Signed-off-by: Tsutomu Itoh Signed-off-by: Mark Fasheh --- fs

[PATCH 02/20] btrfs: Don't BUG_ON() errors in update_ref_for_cow()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh The only caller of update_ref_for_cow() is __btrfs_cow_block() which was originally ignoring any return values. update_ref_for_cow() however doesn't look like a candidate to become a void function - there are a few places where errors can occur. So instead I ch

[PATCH 04/20] btrfs: make insert_ptr() void

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh insert_ptr() always returns zero, so all the exta error handling can go away. This makes it trivial to also make copy_for_split() a void function as it's only return was from insert_ptr(). Finally, this all makes the BUG_ON(ret) in split_leaf() meaningless so I removed

[PATCH 01/20] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()

2011-09-15 Thread Mark Fasheh
From: Mark Fasheh This is called from only one place - create_subvol() which passes errors safely back out to it's caller, btrfs_mksubvol where they are handled. Additionally, btrfs_create_subvol_root() itself bug's needlessly from error return of btrfs_update_inode(). Since create_su

[PATCH 0/20] btrfs: More error handling fixes

2011-09-15 Thread Mark Fasheh
ret) instead of bubbling errors up the stack. The patches were tested using some simple file system commands and a background kernel build. Please review, all constructive feedback is appreciated :) Thanks, --Mark -- Mark Fasheh -- To unsubscribe from this list: send the line "unsubscribe

[PATCH 8/8] btrfs: make del_ptr() and btrfs_del_leaf() void

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh Since fixup_low_keys() has been made void, del_ptr() always returns zero. We can then make it void as well. This allows us in turn to make btrfs_del_leaf() void as the only return value it was previously catching was from del_ptr(). This winds up removing a couple of un-needed

[PATCH 5/8] btrfs: Don't BUG_ON errors in __finish_chunk_alloc()

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh All callers of __finish_chunk_alloc() BUG_ON() return value, so it's trivial for us to always bubble up any errors caught in __finish_chunk_alloc() to be caught there. Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |7 ++- 1 files changed, 2 insertions(

[PATCH 7/8] btrfs: make fixup_low_keys() void

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh This is trivial - fixup_low_keys always returns zero so we can make it void. As a result, we can then make setup_items_for_insert() void too which lets us cut out a couple of BUG_ON(ret) lines. Signed-off-by: Mark Fasheh --- fs/btrfs/ctree.c | 59

[PATCH 6/8] btrfs: fix error check of btrfs_lookup_dentry()

2011-08-18 Thread Mark Fasheh
) which is not really needed - there seems less harm in returning ENOENT to userspace at that point in the stack than there is to crash the machine. Mark: Fixed conflicts against latest tree, gave the patch a more thorough description. Signed-off-by: Tsutomu Itoh Signed-off-by: Mark Fasheh --- fs

[PATCH 4/8] btrfs: make insert_ptr() void

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh insert_ptr() always returns zero, so all the exta error handling can go away. This makes it trivial to also make copy_for_split() a void function as it's only return was from insert_ptr(). Finally, this all makes the BUG_ON(ret) in split_leaf() meaningless so I removed

[PATCH 3/8] btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range()

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh Unfortunately it isn't enough to just exit here - the kzalloc() happens in a loop and the allocated items are added to a linked list whose head is passed in from the caller. To fix the BUG_ON() and also provide the semantic that the list passed in is only modified on su

[PATCH 2/8] btrfs: Don't BUG_ON() errors in update_ref_for_cow()

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh The only caller of update_ref_for_cow() is __btrfs_cow_block() which was originally ignoring any return values. update_ref_for_cow() however doesn't look like a candidate to become a void function - there are a few places where errors can occur. So instead I ch

[PATCH 1/8] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()

2011-08-18 Thread Mark Fasheh
From: Mark Fasheh This is called from only one place - create_subvol() which passes errors safely back out to it's caller, btrfs_mksubvol where they are handled. Additionally, btrfs_create_subvol_root() itself bug's needlessly from error return of btrfs_update_inode(). Since create_su

[PATCH 0/8] btrfs: Error handling fixes

2011-08-18 Thread Mark Fasheh
Hi, The following are assorted fixes to error handling from all parts of the Btrfs code. Every patch in this series stands on it's own, with the exception of the last patch which relies on the one before it (so patches 7 and 8 can be considered a pair). I also included in this series an uncommit

[PATCH] btrfs: make insert_ptr() void

2011-08-08 Thread Mark Fasheh
insert_ptr() always returns zero, so all the exta error handling can go away. This makes it trivial to also make copy_for_split() a void function as it's only return was from insert_ptr(). Finally, this all makes the BUG_ON(ret) in split_leaf() meaningless so I removed that. Signed-off-by:

[PATCH] btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range()

2011-08-08 Thread Mark Fasheh
t and verifying that when this hits (git clone seemed to exercise this), the function throws the proper error. Unfortunately but predictably, we later hit a BUG_ON(ret) type line that still hasn't been fixed up ;) Signed-off-by: Mark Fasheh --- fs/btrfs/file-item.c | 15 +-- 1 fil

[PATCH] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()

2011-08-05 Thread Mark Fasheh
d to catch errors we can bubble this one up too. Signed-off-by: Mark Fasheh --- fs/btrfs/inode.c |3 +-- fs/btrfs/ioctl.c |2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 15fceef..7028c0c 100644 --- a/fs/btrfs/inode.c +++ b/fs/btr

[PATCH] btrfs: Handle NULL inode return from btrfs_lookup_dentry()

2011-08-05 Thread Mark Fasheh
-ENOENT back to userspace as we're pretty high up the call path at this point. Signed-off-by: Mark Fasheh --- fs/btrfs/ioctl.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7cf0133..fc9525f 100644 --- a/fs/btrfs/i

Re: [PATCH 6/7] btrfs: Don't BUG_ON alloc_path errors in find_next_chunk

2011-07-25 Thread Mark Fasheh
n: > > } > > > > ret = btrfs_alloc_chunk(trans, extent_root, flags); > > + if (ret < 0 && ret != -ENOSPC) > > + return ret; > > + > > You need mutex_unlock() before return. Of course... Here's an updated patch (git tree has

Re: [PATCH 7/7] btrfs: don't BUG_ON allocation errors in btrfs_drop_snapshot

2011-07-25 Thread Mark Fasheh
On Fri, Jul 22, 2011 at 09:45:19AM +0900, Tsutomu Itoh wrote: > (2011/07/22 4:48), Mark Fasheh wrote: > > In addition to properly handling allocation failure from btrfs_alloc_path, I > > also fixed up the kzalloc error handling code immediately below it. > > > >

[PATCH 5/7] btrfs: Don't BUG_ON alloc_path errors in btrfs_balance()

2011-07-21 Thread Mark Fasheh
e() anyway). Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 19450bc..530a2fc 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2061,8 +2061,10 @@ int btrfs_bala

[PATCH 6/7] btrfs: Don't BUG_ON alloc_path errors in find_next_chunk

2011-07-21 Thread Mark Fasheh
btrfs_alloc_chunk() which can now return -ENOMEM. Instead of setting space_info->full on any error from btrfs_alloc_chunk() I catch and return every error value _except_ -ENOSPC. Thanks goes to Tsutomu Itoh for pointing that issue out. Signed-off-by: Mark Fasheh --- fs/btrfs/extent-tree.c |3 +++ fs/bt

[PATCH 7/7] btrfs: don't BUG_ON allocation errors in btrfs_drop_snapshot

2011-07-21 Thread Mark Fasheh
In addition to properly handling allocation failure from btrfs_alloc_path, I also fixed up the kzalloc error handling code immediately below it. Signed-off-by: Mark Fasheh --- fs/btrfs/extent-tree.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent

[PATCH 3/7] btrfs: Don't BUG_ON alloc_path errors in btrfs_truncate_inode_items

2011-07-21 Thread Mark Fasheh
I moved the path allocation up a few lines to the top of the function so that we couldn't get into the state where we've dropped delayed items and the extent cache but fail due to -ENOMEM. Signed-off-by: Mark Fasheh --- fs/btrfs/inode.c |9 + 1 files changed, 5 insert

[PATCH 4/7] btrfs: Don't BUG_ON alloc_path errors in btrfs_read_locked_inode

2011-07-21 Thread Mark Fasheh
btrfs_iget() also needed an update so that errors from btrfs_locked_inode() are caught and bubbled back up. Signed-off-by: Mark Fasheh --- fs/btrfs/inode.c | 22 +- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index

[PATCH 2/7] btrfs: Don't BUG_ON alloc_path errors in replay_one_buffer()

2011-07-21 Thread Mark Fasheh
The two ->process_func call sites in tree-log.c which were ignoring a return code have also been updated to gracefully exit as well. Signed-off-by: Mark Fasheh --- fs/btrfs/tree-log.c | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/tree-log.c b

[PATCH 1/7] btrfs: don't BUG_ON btrfs_alloc_path() errors

2011-07-21 Thread Mark Fasheh
, btrfs_lookup_csums_range, btrfs_csum_file_blocks, btrfs_mark_extent_written, btrfs_inode_by_name, btrfs_new_inode, btrfs_symlink, insert_reserved_file_extent, and run_delalloc_nocow Signed-off-by: Mark Fasheh --- fs/btrfs/extent-tree.c | 12 +--- fs/btrfs/file-item.c |7 +-- fs/btrfs/file.c

[PATCH 0/7] btrfs: don't BUG_ON btrfs_alloc_path errors v2

2011-07-21 Thread Mark Fasheh
Changelog: - Updated patch 6 after review from Tsutomu Itoh Hi, The following patches attempt to replace all the paths where we BUG_ON the return value of btrfs_alloc_path with proper error handling. It's pretty clear that these places aren't BUGing because of code error. To be explicit

Re: [PATCH 7/7] btrfs: don't BUG_ON allocation errors in btrfs_drop_snapshot

2011-07-18 Thread Mark Fasheh
On Fri, Jul 15, 2011 at 12:04:46PM +0900, Tsutomu Itoh wrote: > (2011/07/15 7:15), Mark Fasheh wrote: > > In addition to properly handling allocation failure from btrfs_alloc_path, I > > also fixed up the kzalloc error handling code immediately below it. > > Need not you

Re: [PATCH 6/7] btrfs: Don't BUG_ON alloc_path errors in find_next_chunk

2011-07-18 Thread Mark Fasheh
gt; 3279 if (ret) > 3280 space_info->full = 1; > 3281 else > 3282 ret = 1; > > Is it OK? I don't think so actually. It looks like in this case we might want to bubble the error back up past do_chunk_alloc and leave space_info unt

[PATCH 3/7] btrfs: Don't BUG_ON alloc_path errors in btrfs_truncate_inode_items

2011-07-14 Thread Mark Fasheh
I moved the path allocation up a few lines to the top of the function so that we couldn't get into the state where we've dropped delayed items and the extent cache but fail due to -ENOMEM. Signed-off-by: Mark Fasheh --- fs/btrfs/inode.c |9 + 1 files changed, 5 insert

[PATCH 2/7] btrfs: Don't BUG_ON alloc_path errors in replay_one_buffer()

2011-07-14 Thread Mark Fasheh
The two ->process_func call sites in tree-log.c which were ignoring a return code have also been updated to gracefully exit as well. Signed-off-by: Mark Fasheh --- fs/btrfs/tree-log.c | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/tree-log.c b

[PATCH 6/7] btrfs: Don't BUG_ON alloc_path errors in find_next_chunk

2011-07-14 Thread Mark Fasheh
I also removed the BUG_ON from error return of find_next_chunk in init_first_rw_device(). It turns out that the only caller of init_first_rw_device() also BUGS on any nonzero return so no actual behavior change has occurred here. Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |6

[PATCH 7/7] btrfs: don't BUG_ON allocation errors in btrfs_drop_snapshot

2011-07-14 Thread Mark Fasheh
In addition to properly handling allocation failure from btrfs_alloc_path, I also fixed up the kzalloc error handling code immediately below it. Signed-off-by: Mark Fasheh --- fs/btrfs/extent-tree.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent

[PATCH 5/7] btrfs: Don't BUG_ON alloc_path errors in btrfs_balance()

2011-07-14 Thread Mark Fasheh
e() anyway). Signed-off-by: Mark Fasheh --- fs/btrfs/volumes.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 19450bc..530a2fc 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2061,8 +2061,10 @@ int btrfs_bala

[PATCH 4/7] btrfs: Don't BUG_ON alloc_path errors in btrfs_read_locked_inode

2011-07-14 Thread Mark Fasheh
btrfs_iget() also needed an update so that errors from btrfs_locked_inode() are caught and bubbled back up. Signed-off-by: Mark Fasheh --- fs/btrfs/inode.c | 22 +- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index

[PATCH 1/7] btrfs: don't BUG_ON btrfs_alloc_path() errors

2011-07-14 Thread Mark Fasheh
, btrfs_lookup_csums_range, btrfs_csum_file_blocks, btrfs_mark_extent_written, btrfs_inode_by_name, btrfs_new_inode, btrfs_symlink, insert_reserved_file_extent, and run_delalloc_nocow Signed-off-by: Mark Fasheh --- fs/btrfs/extent-tree.c | 12 +--- fs/btrfs/file-item.c |7 +-- fs/btrfs/file.c

[PATCH 0/7] btrfs: don't BUG_ON btrfs_alloc_path errors

2011-07-14 Thread Mark Fasheh
Hi, The following patches attempt to replace all the paths where we BUG_ON the return value of btrfs_alloc_path with proper error handling. It's pretty clear that these places aren't BUGing because of code error. To be explicit, much of the code is doing something like this: path

Re: [PATCH 1/7] btrfs: don't BUG_ON btrfs_alloc_path() errors

2011-07-14 Thread Mark Fasheh
On Thu, Jul 14, 2011 at 03:00:07PM -0700, Mark Fasheh wrote: > This patch fixes many callers of btrfs_alloc_path() which BUG_ON allocation > failure. All the sites that are fixed in this patch were checked by me to > be fairly trivial to fix because of at least one of two criteria: Plea

[PATCH 1/7] btrfs: don't BUG_ON btrfs_alloc_path() errors

2011-07-14 Thread Mark Fasheh
, btrfs_lookup_csums_range, btrfs_csum_file_blocks, btrfs_mark_extent_written, btrfs_inode_by_name, btrfs_new_inode, btrfs_symlink, insert_reserved_file_extent, and run_delalloc_nocow Signed-off-by: Mark Fasheh --- fs/btrfs/extent-tree.c | 12 +--- fs/btrfs/file-item.c |7 +-- fs/btrfs/file.c

[PATCH 0/7] btrfs: don't BUG_ON btrfs_alloc_path errors

2011-07-14 Thread Mark Fasheh
Hi, The following patches attempt to replace all the paths where we BUG_ON the return value of btrfs_alloc_path with proper error handling. It's pretty clear that these places aren't BUGing because of code error. To be explicit, much of the code is doing something like this: path

[PATCH] btrfs: make btrfs_set_root_node void

2011-07-14 Thread Mark Fasheh
. Signed-off-by: Mark Fasheh --- fs/btrfs/ctree.h |4 ++-- fs/btrfs/root-tree.c |5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 3b859a3..20bd05f 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2404,8 +2404,8

[PATCH] btrfs: Remove BUG_ON's from btrfs_update_root

2011-06-28 Thread Mark Fasheh
y. In order to maintain behavior I placed a BUG_ON clause there - at least though it's now at a higher level in the code. Signed-off-by: Mark Fasheh --- fs/btrfs/ioctl.c |1 + fs/btrfs/root-tree.c |6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/io

Re: [RFC][PATCH 1/2] vfs: allow /proc/pid/maps to return a custom device

2011-05-19 Thread Mark Fasheh
On Sat, May 14, 2011 at 08:06:04PM -0700, Eric W. Biederman wrote: > Mark Fasheh writes: > > > This patch introduces a callback in the super_operations structure, > > 'get_maps_dev' which is then used by procfs to query which device to return > > for repo

[RFC][PATCH 2/2] Subject: btrfs: Introduce btrfs_get_maps_dev()

2011-05-13 Thread Mark Fasheh
Use this to return the subvolume superblock in proc instead of the global superblock which is automatically taken today. This fixes a userspace breakage where discrepancies between the devices two would confuse software such as lsof. Signed-off-by: Mark Fasheh --- fs/btrfs/super.c |6

<    1   2   3   4   5   6   >