Displaying 20 results from an estimated 55 matches for "btrfs_release_path".
2013 Apr 25
0
[PATCH] Btrfs: remove almost all of the BUG()'s from tree-log.c
..._ordered_sum,
list);
- ret = btrfs_csum_file_blocks(trans,
+ if (!ret)
+ ret = btrfs_csum_file_blocks(trans,
root->fs_info->csum_root,
sums);
- BUG_ON(ret);
list_del(&sums->list);
kfree(sums);
}
+ if (ret)
+ goto out;
} else {
btrfs_release_path(path);
}
} else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
/* inline extents are easy, we just overwrite them */
ret = overwrite_item(trans, root, path, eb, slot, key);
- BUG_ON(ret);
+ if (ret)
+ goto out;
}
inode_add_bytes(inode, nbytes);
@@ -717,20 +723,21 @@ static noinl...
2009 Nov 12
0
[PATCH 03/12] Btrfs: Rewrite btrfs_drop_extents
...t = 0;
+ u64 extent_end = 0;
+ int del_nr = 0;
+ int del_slot = 0;
+ int extent_type;
int recow;
int ret;
- inline_limit = 0;
if (drop_cache)
btrfs_drop_extent_cache(inode, start, end - 1, 0);
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
+
while (1) {
recow = 0;
- btrfs_release_path(root, path);
ret = btrfs_lookup_file_extent(trans, root, path, inode->i_ino,
search_start, -1);
if (ret < 0)
- goto out;
- if (ret > 0) {
- if (path->slots[0] == 0) {
- ret = 0;
- goto out;
- }
- path->slots[0]--;
+ break;
+ if (ret > 0 &&a...
2013 Oct 28
0
[PATCH] Btrfs: log recovery, don't unlink inode always on error
...ee-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1832,7 +1832,7 @@ again:
dir_key->offset,
name, name_len, 0);
}
- if (IS_ERR_OR_NULL(log_di)) {
+ if (!log_di || (IS_ERR(log_di) && PTR_ERR(log_di) == -ENOENT)) {
btrfs_dir_item_key_to_cpu(eb, di, &location);
btrfs_release_path(path);
btrfs_release_path(log_path);
@@ -1869,6 +1869,9 @@ again:
goto again;
ret = 0;
goto out;
+ } else if (IS_ERR(log_di)) {
+ kfree(name);
+ return PTR_ERR(log_di);
}
btrfs_release_path(log_path);
kfree(name);
--
1.7.9.5
--
To unsubscribe from this list: send th...
2011 May 27
0
[PATCH] Btrfs: try to only do one btrfs_search_slot in do_setxattr
...LACE) {
+ di = btrfs_lookup_xattr(trans, root, path, inode->i_ino, name,
+ strlen(name), -1);
+ if (IS_ERR(di)) {
+ ret = PTR_ERR(di);
+ goto out;
+ } else if (!di) {
+ ret = -ENODATA;
goto out;
}
-
ret = btrfs_delete_one_dir_name(trans, root, path, di);
- BUG_ON(ret);
- btrfs_release_path(root, path);
-
- /* if we don''t have a value then we are removing the xattr */
- if (!value)
+ if (ret)
goto out;
- } else {
btrfs_release_path(root, path);
-
- if (flags & XATTR_REPLACE) {
- /* we couldn''t find the attr to replace */
- ret = -ENODATA;
- goto...
2012 Jun 21
0
[RFC PATCH V2] Btrfs: introduce extent buffer cache for each i-node
...= BTRFS_MAX_LEVEL ||
+ !p->nodes[level + 1])) {
+ ret = -ERESTART;
+ goto done;
+ }
+
btrfs_set_path_blocking(p);
/*
* must have write locks on this node and the
* parent
*/
- if (level + 1 > write_lock_level) {
- write_lock_level = level + 1;
- btrfs_release_path(p);
- goto again;
+ if (level + 1 > *write_lock_level) {
+ *write_lock_level = level + 1;
+ ret = -EAGAIN;
+ goto done;
}
- err = btrfs_cow_block(trans, root, b,
+ ret = btrfs_cow_block(trans, root, b,
p->nodes[level + 1],
p->slots[level + 1]...
2013 Aug 27
7
[PATCH] Btrfs: fix deadlock in uuid scan kthread
...oid *data)
(int)sizeof(root_item));
if (btrfs_root_refs(&root_item) == 0)
goto skip;
- if (!btrfs_is_empty_uuid(root_item.uuid)) {
+
+ if (!btrfs_is_empty_uuid(root_item.uuid) ||
+ !btrfs_is_empty_uuid(root_item.received_uuid)) {
+ if (trans)
+ goto update_tree;
+
+ btrfs_release_path(path);
/*
* 1 - subvol uuid item
* 1 - received_subvol uuid item
@@ -3519,6 +3525,11 @@ static int btrfs_uuid_scan_kthread(void *data)
ret = PTR_ERR(trans);
break;
}
+ continue;
+ } else
+ goto skip;
+update_tree:
+ if (!btrfs_is_empty_uuid(root_item.uuid)) {
r...
2010 Jul 26
6
[PATCH] Btrfs: compressed file size ioctl
...trfs_file_extent_disk_num_bytes(leaf,
+ extent);
+ } else if (type == BTRFS_FILE_EXTENT_INLINE) {
+ datal = btrfs_file_extent_ram_bytes(leaf,
+ extent);
+ compressed_size +=
+ btrfs_file_extent_inline_item_len(leaf,
+ btrfs_item_nr(leaf, slot));
+ }
+ btrfs_release_path(root, path);
+ }
+
+ btrfs_release_path(root, path);
+ key.offset++;
+ }
+
+ /* We''ve succeeded in going through all extents; set the final size. */
+ if (copy_to_user(argp, &compressed_size, sizeof(compressed_size)))
+ ret = -EFAULT;
+ else
+ ret = 0;
+
+out:
+ btrfs_release_path...
2010 Sep 03
0
[PATCH 1/2] btrfs: document where we use BUG_ON instead of error handling
...et);
+ btrfs_fixable_bug_on(ret);
return 1;
}
@@ -4133,7 +4133,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
ret = remove_extent_backref(trans, extent_root, path,
NULL, refs_to_drop,
is_data);
- BUG_ON(ret);
+ btrfs_fixable_bug_on(ret);
btrfs_release_path(extent_root, path);
path->leave_spinning = 1;
@@ -4149,7 +4149,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
(unsigned long long)bytenr);
btrfs_print_leaf(extent_root, path->nodes[0]);
}
- BUG_ON(ret);
+ btrfs_fixable_bug_on(ret);
ext...
2008 Jan 07
1
[PATCH]Add rollback support for the converter
...p_extent_ref(struct btrf
btrfs_init_path(&path);
key.objectid = bytenr;
- key.type = BTRFS_EXTENT_ITEM_KEY;
key.offset = num_bytes;
+ btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY);
ret = btrfs_search_slot(trans, root->fs_info->extent_root,
&key, &path, 0, 0);
btrfs_release_path(root, &path);
@@ -738,6 +751,9 @@ static int lookup_extent_ref(struct btrf
* Construct a range of ext2fs image file.
* scan block allocation bitmap, find all blocks used by the ext2fs
* in this range and create file extents that point to these blocks.
+ *
+ * Note: Before calling the func...
2012 Sep 17
0
[PATCH] Btrfs: do not hold the write_lock on the extent tree while logging V2
...ren''t
@@ -2971,21 +2979,25 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
ret = copy_items(trans, inode, dst_path, args.src,
args.start_slot, args.nr,
LOG_INODE_ALL);
- if (ret)
+ if (ret) {
+ free_extent_map(em);
continue;
+ }
btrfs_release_path(path);
args.nr = 0;
}
ret = log_one_extent(trans, inode, root, em, path, dst_path, &args);
+ free_extent_map(em);
+ write_lock(&tree->lock);
}
+ WARN_ON(!list_empty(&extents));
+ write_unlock(&tree->lock);
if (!ret && args.nr)
ret = copy_items(tr...
2010 Jul 29
1
[Bug] check return of kmalloc()
...S);
atomic_set(&cb->pending_bios, 0);
cb->errors = 0;
cb->inode = inode;
--- ./fs/btrfs/tree-log.c 2010-07-06 16:45:48.000000000 +0400
+++ /tmp/cocci-output-7783-8f7d1b-tree-log.c 2010-07-28 18:43:08.000000000 +0400
@@ -336,8 +336,6 @@ static noinline int overwrite_item(struc
btrfs_release_path(root, path);
return 0;
}
- dst_copy = kmalloc(item_size, GFP_NOFS);
- src_copy = kmalloc(item_size, GFP_NOFS);
read_extent_buffer(eb, src_copy, src_ptr, item_size);
@@ -664,7 +662,6 @@ static noinline int drop_one_dir_item(st
btrfs_dir_item_key_to_cpu(leaf, di, &location);...
2012 Sep 17
13
[PATCH 1/2 v3] Btrfs: use flag EXTENT_DEFRAG for snapshot-aware defrag
We''re going to use this flag EXTENT_DEFRAG to indicate which range
belongs to defragment so that we can implement snapshow-aware defrag:
We set the EXTENT_DEFRAG flag when dirtying the extents that need
defragmented, so later on writeback thread can differentiate between
normal writeback and writeback started by defragmentation.
This patch is used for the latter one.
Originally patch
2011 Jan 06
3
Offline Deduplication for Btrfs V2
Just a quick update, I''ve dropped the hashing stuff in favor of doing a memcmp
in the kernel to make sure the data is still the same. The thing that takes a
while is reading the data up from disk, so doing a memcmp of the entire buffer
isn''t that big of a deal, not to mention there''s a possiblity for malicious
users if there is a problem with the hashing algorithms we
2009 May 12
0
[PATCH 1/2] btrfs-progs: mixed back ref support
...s[0]);
+ if (key.objectid != bytenr ||
+ key.type != BTRFS_EXTENT_DATA_REF_KEY)
+ goto fail;
+
+ ref = btrfs_item_ptr(leaf, path->slots[0],
+ struct btrfs_extent_data_ref);
+
+ if (match_extent_data_ref(leaf, ref, root_objectid,
+ owner, offset)) {
+ if (recow) {
+ btrfs_release_path(root, path);
+ goto again;
+ }
+ err = 0;
+ break;
+ }
+ path->slots[0]++;
}
- ret = 0;
-out:
- return ret;
+fail:
+ return err;
}
-static int noinline insert_extent_backref(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- struct btrfs_path *path,
-...
2013 Apr 03
0
[PATCH] Btrfs-progs: add a free space cache checker to fsck
...ead = 0;
+ int ret = 0;
+
+ key.objectid = ino;
+ key.type = BTRFS_EXTENT_DATA_KEY;
+ key.offset = 0;
+
+ ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
+ if (ret) {
+ printf("Couldn''t find file extent item for free space inode"
+ " %Lu\n", ino);
+ btrfs_release_path(root, path);
+ return -EINVAL;
+ }
+
+ while (total_read < io_ctl->total_size) {
+ if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) {
+ ret = btrfs_next_leaf(root, path);
+ if (ret) {
+ ret = -EINVAL;
+ break;
+ }
+ }
+ leaf = path->nodes[0];
+
+ btrfs_...
2013 Mar 15
0
[PATCH] Btrfs-progs: add skinny metadata support to progs V3
...Y &&
found_key.type != BTRFS_TREE_BLOCK_REF_KEY &&
found_key.type != BTRFS_EXTENT_DATA_REF_KEY &&
found_key.type != BTRFS_EXTENT_REF_V0_KEY &&
@@ -2961,9 +2988,13 @@ static int delete_extent_records(struct btrfs_trans_handle *trans,
break;
btrfs_release_path(NULL, path);
- if (found_key.type == BTRFS_EXTENT_ITEM_KEY) {
+ if (found_key.type == BTRFS_EXTENT_ITEM_KEY ||
+ found_key.type == BTRFS_METADATA_ITEM_KEY) {
+ u64 bytes = (found_key.type == BTRFS_EXTENT_ITEM_KEY) ?
+ found_key.offset : root->leafsize;
+
ret = btrfs_update_bloc...
2012 Jan 30
3
[PATCH] Btrfs: allow cloning ranges within the same file
...ed only if
+ * they don''t overlap
+ */
+ if (src == inode && !(off + len <= destoff || destoff + len <= off))
+ goto out_unlock;
+
if (destoff > inode->i_size) {
ret = btrfs_cont_expand(inode, inode->i_size, destoff);
if (ret)
@@ -2543,8 +2548,12 @@ out:
btrfs_release_path(path);
unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS);
out_unlock:
- mutex_unlock(&src->i_mutex);
- mutex_unlock(&inode->i_mutex);
+ if (src != inode) {
+ mutex_unlock(&src->i_mutex);
+ mutex_unlock(&inode->i_mutex);
+ } else {
+ mutex_unlock(...
2013 Nov 12
0
[PATCH] Btrfs: incompatible format change to remove hole extents V4
...* So we need to adjust how we search for holes, we need to drop the
+ * path and re-search for the first extent key we found, and then walk
+ * forward until we hit the last one we copied.
+ */
+ if (need_find_last_extent) {
+ /* btrfs_prev_leaf could return 1 without releasing the path */
+ btrfs_release_path(src_path);
+ ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &first_key,
+ src_path, 0, 0);
+ if (ret < 0)
+ return ret;
+ ASSERT(ret == 0);
+ src = src_path->nodes[0];
+ i = src_path->slots[0];
+ } else {
+ i = start_slot;
+ }
+
+ /*
+ * Ok so here we need to go th...
2013 Oct 16
3
trivial cleanups
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
2008 Oct 27
0
[PATCH 3/4] update nodatacow code
...}
+out_check:
+ if (extent_end <= start) {
+ path->slots[0]++;
+ goto next_slot;
+ }
+ if (!nocow) {
+ if (cow_start == (u64)-1)
+ cow_start = cur_offset;
+ cur_offset = extent_end;
+ if (cur_offset > end)
+ break;
+ path->slots[0]++;
+ goto next_slot;
}
btrfs_release_path(root, path);
- start = extent_end;
- if (start <= end) {
- loops++;
- goto again;
+ if (cow_start != (u64)-1) {
+ ret = cow_file_range(inode, cow_start,
+ found_key.offset - 1);
+ BUG_ON(ret);
+ cow_start = (u64)-1;
}
- } else {
-not_found:
- btrfs_end_transaction(trans...