search for: btrfs_extent_data_key

Displaying 20 results from an estimated 25 matches for "btrfs_extent_data_key".

2011 Aug 09
2
[PATCH] Btrfs: truncate pages from clone ioctl target range
...fd, btrfs_wait_ordered_range(src, off, len); } + /* truncate page cache pages from target inode range */ + truncate_inode_pages_range(&inode->i_data, off, + ((off+len+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)-1); + /* clone data */ key.objectid = btrfs_ino(src); key.type = BTRFS_EXTENT_DATA_KEY; -- 1.7.0 -- 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
2009 Nov 12
0
[PATCH 03/12] Btrfs: Rewrite btrfs_drop_extents
...- } - path->slots[0]--; + break; + if (ret > 0 && path->slots[0] > 0 && search_start == start) { + leaf = path->nodes[0]; + btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); + if (key.objectid == inode->i_ino && + key.type == BTRFS_EXTENT_DATA_KEY) + path->slots[0]--; } + ret = 0; next_slot: - keep = 0; - bookend = 0; - found_extent = 0; - found_inline = 0; - compression = 0; - encryption = 0; - extent = NULL; leaf = path->nodes[0]; - slot = path->slots[0]; - ret = 0; - btrfs_item_key_to_cpu(leaf, &key, slot...
2013 Nov 12
0
[PATCH] Btrfs: incompatible format change to remove hole extents V4
...4 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1963,11 +1963,13 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, struct btrfs_key key; int ret; + if (btrfs_fs_incompat(root->fs_info, NO_HOLES)) + goto out; + key.objectid = btrfs_ino(inode); key.type = BTRFS_EXTENT_DATA_KEY; key.offset = offset; - ret = btrfs_search_slot(trans, root, &key, path, 0, 1); if (ret < 0) return ret; @@ -2064,8 +2066,10 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) u64 drop_end; int ret = 0; int err = 0; + int rsv_count; bool same_pa...
2010 Jul 26
6
[PATCH] Btrfs: compressed file size ioctl
...rn -ENOMEM; + + path->reada = 2; + mutex_lock(&inode->i_mutex); + + /* do any pending delalloc/csum calc on inode, one way or + another, and lock file content */ + btrfs_wait_ordered_range(inode, 0, (u64)-1); + + /* search for the inode */ + key.objectid = inode->i_ino; + key.type = BTRFS_EXTENT_DATA_KEY; + key.offset = 0; + + while (1) { + /* note the key will change type as we walk through the tree */ + ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); + if (ret < 0) + goto out; + + nritems = btrfs_header_nritems(path->nodes[0]); + if (path->slots[0] >= nritems) { +...
2008 Oct 27
0
[PATCH 3/4] update nodatacow code
...bytenr) -{ - struct btrfs_root *old_root; - struct btrfs_path *path = NULL; - struct extent_buffer *eb; - struct btrfs_file_extent_item *item; - u64 ref_generation; - u64 min_generation; - u64 extent_start; - u32 ref_count; - int level; - int ret; - - BUG_ON(trans == NULL); - BUG_ON(key->type != BTRFS_EXTENT_DATA_KEY); - ret = get_reference_status(root, bytenr, 0, key->objectid, - &min_generation, &ref_count); - if (ret) - return ret; - - if (ref_count != 1) - return 1; - - old_root = root->dirty_root->root; - ref_generation = old_root->root_key.offset; - - /* all references are crea...
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
2009 Jan 21
0
[PATCH] Progs: update convert for uninitialized block groups
...+ goto fail; + if (ret > 0) + break; + btrfs_item_key_to_cpu(path.nodes[0], &key, + path.slots[0]); + btrfs_release_path(root, &path); + goto recow; + } btrfs_item_key_to_cpu(leaf, &key, path.slots[0]); if (key.objectid != objectid || key.type != BTRFS_EXTENT_DATA_KEY) @@ -2048,7 +2070,7 @@ static int relocate_one_reference(struct if (data.num_blocks > 0) { ret = record_file_blocks(trans, root, objectid, &inode, data.first_block, data.disk_block, - data.num_blocks, 0); + data.num_blocks, datacsum); if (ret) goto fail; } @@ -...
2010 Dec 11
1
[RFC] Improve btrfs subvolume find-new command
...+ * just in case the item was too big, pass something other + * than garbage + */ + if (sh->len == 0) + item = &backup; + else + item = (struct btrfs_file_extent_item *)(args->buf + + off); + found_gen = btrfs_stack_file_extent_generation(item); + + if (sh->type == BTRFS_EXTENT_DATA_KEY && + found_gen >= oldest_gen) { + print_filename_one_time(fd, sh, old_objectid, verbose); + if(verbose>=100) + print_one_extent(sh,item, found_gen); + } else if (sh->type == BTRFS_INODE_ITEM_KEY ){ + struct btrfs_inode_item *i = + (struct btrfs_inode_item*)(args-...
2012 Jun 21
0
[RFC PATCH V2] Btrfs: introduce extent buffer cache for each i-node
...ns_handle *trans, struct btrfs_key file_key; struct btrfs_path *path; struct extent_buffer *leaf; + u64 objectid = btrfs_ino(inode); path = btrfs_alloc_path(); if (!path) @@ -57,8 +58,8 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY); path->leave_spinning = 1; - ret = btrfs_insert_empty_item(trans, root, path, &file_key, - sizeof(*item)); + ret = btrfs_insert_empty_item_for_inode(trans, root, inode, path, + &file_key, sizeof(*item)); if (ret < 0) goto out; BUG_ON(ret); /* Can''t h...
2012 Jan 05
4
[RFC][PATCH 3/3] Btrfs: improve truncation of btrfs
...ize - 1; u64 ino = btrfs_ino(inode); + u64 old_size = i_size_read(inode); u32 found_type; int pending_del_nr = 0; int pending_del_slot = 0; @@ -3138,6 +3139,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, int err = 0; BUG_ON(new_size > 0 && min_type != BTRFS_EXTENT_DATA_KEY); + BUG_ON(new_size & mask); path = btrfs_alloc_path(); if (!path) @@ -3190,6 +3192,13 @@ search_again: ret = btrfs_release_and_test_data_extent(trans, root, path, inode, found_key.offset, new_size); + if (root->ref_cows || + root == root->fs_info->tree_...
2012 Oct 01
1
[RFC] [PATCH] Btrfs: rework can_nocow_odirect
...path->slots[0]; - if (ret == 1) { - if (slot == 0) { - /* can''t find the item, must cow */ - ret = 0; - goto out; - } - slot--; - } - ret = 0; - leaf = path->nodes[0]; - btrfs_item_key_to_cpu(leaf, &key, slot); - if (key.objectid != btrfs_ino(inode) || - key.type != BTRFS_EXTENT_DATA_KEY) { - /* not our file or wrong item type, must cow */ - goto out; - } - - if (key.offset > offset) { - /* Wrong offset, must cow */ - goto out; - } - - fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); - found_type = btrfs_file_extent_type(leaf, fi); - if (found_type != BTRFS_FI...
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 Nov 12
0
[PATCH 05/12] Btrfs: Avoid orphan inodes cleanup during replaying log
...tem exist. extents past the new EOF + * will be truncated later by orphan cleanup. */ if (S_ISREG(mode)) { - inode = read_one_inode(root, - key.objectid); - BUG_ON(!inode); - - ret = btrfs_truncate_inode_items(wc->trans, - root, inode, inode->i_size, - BTRFS_EXTENT_DATA_KEY); + ret = insert_orphan_item(wc->trans, root, + key.objectid); BUG_ON(ret); - - /* if the nlink count is zero here, the iput - * will free the inode. We bump it to make - * sure it doesn''t get freed until the link - * count fixup is done - */ - if (...
2011 Jun 21
19
[GIT PULL v3] Btrfs: improve write ahead log with sub transaction
I''ve been working to try to improve the write-ahead log''s performance, and I found that the bottleneck addresses in the checksum items, especially when we want to make a random write on a large file, e.g a 4G file. Then a idea for this suggested by Chris is to use sub transaction ids and just to log the part of inode that had changed since either the last log commit or the last
2011 Mar 23
0
[PATCH] Btrfs: cleanup some BUG_ON()
...c 2011-03-23 11:28:09.000000000 +0900 @@ -48,7 +48,8 @@ int btrfs_insert_file_extent(struct btrf struct extent_buffer *leaf; path = btrfs_alloc_path(); - BUG_ON(!path); + if (!path) + return -ENOMEM; file_key.objectid = objectid; file_key.offset = pos; btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY); diff -urNp linux-2.6.38/fs/btrfs/inode-map.c linux-2.6.38.new/fs/btrfs/inode-map.c --- linux-2.6.38/fs/btrfs/inode-map.c 2011-03-15 10:20:32.000000000 +0900 +++ linux-2.6.38.new/fs/btrfs/inode-map.c 2011-03-23 11:28:09.000000000 +0900 @@ -30,7 +30,8 @@ int btrfs_find_highest_inode(struct btrf i...
2008 Jan 07
1
[PATCH]Add rollback support for the converter
...tspec); + total_bytes *= root->sectorsize; + btrfs_release_path(ext2_root, &path); + if (total_bytes != btrfs_inode_size(leaf, inode)) { + fprintf(stderr, "image file size mismatch\n"); + goto fail; + } + + key.objectid = objectid; + key.offset = 0; + btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY); + ret = btrfs_search_slot(NULL, ext2_root, &key, &path, 0, 0); + if (ret != 0) { + fprintf(stderr, "unable to find first file extent\n"); + goto fail; + } + + for (offset = 0; offset < total_bytes; ) { + leaf = path.nodes[0]; + if (path.slots[0] >= btrfs_header_nritems...
2013 Apr 03
0
[PATCH] Btrfs-progs: add a free space cache checker to fsck
...int io_ctl_prepare_pages(struct io_ctl *io_ctl, struct btrfs_root *root, + struct btrfs_path *path, u64 ino) +{ + struct extent_buffer *leaf; + struct btrfs_file_extent_item *fi; + struct btrfs_key key; + u64 bytenr, len; + u64 total_read = 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 <...
2012 Mar 20
13
[PATCH 0 of 3 v2] PV-GRUB: add support for ext4 and btrfs
Hi, The following patches add support for ext4 and btrfs to PV-GRUB. These patches are taken nearly verbatim from those provided by Fedora and Gentoo. We''ve been using these patches for the PV-GRUB images available in EC2 for some time now with no problems. Changes from v1: - Makefile has been changed to check the exit code from patch - The btrfs patch has been rebased to apply
2013 Oct 16
0
[PATCH] Btrfs: add tests for btrfs_get_extent V2
...gt;node; + struct btrfs_key key; + u32 value_len = sizeof(struct btrfs_file_extent_item); + + if (type == BTRFS_FILE_EXTENT_INLINE) + value_len += len; + memset(&path, 0, sizeof(path)); + + path.nodes[0] = leaf; + path.slots[0] = slot; + + key.objectid = BTRFS_FIRST_FREE_OBJECTID; + key.type = BTRFS_EXTENT_DATA_KEY; + key.offset = start; + + setup_items_for_insert(root, &path, &key, &value_len, value_len, + value_len + sizeof(struct btrfs_item), 1); + fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); + btrfs_set_file_extent_generation(leaf, fi, 1); + btrfs_set_file_extent_ty...
2013 Aug 06
6
[PATCH 0/4] btrfs: out-of-band (aka offline) dedupe v4
Hi, The following series of patches implements in btrfs an ioctl to do out-of-band deduplication of file extents. To be clear, this means that the file system is mounted and running, but the dedupe is not done during file writes, but after the fact when some userspace software initiates a dedupe. The primary patch is loosely based off of one sent by Josef Bacik back in January, 2011.