Chris Mason | 6cbd557 | 2007-06-12 09:07:21 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Oracle. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public |
| 6 | * License v2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public |
| 14 | * License along with this program; if not, write to the |
| 15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 16 | * Boston, MA 021110-1307, USA. |
| 17 | */ |
| 18 | |
Chris Mason | 1e1d270 | 2007-03-15 19:03:33 -0400 | [diff] [blame] | 19 | #include "ctree.h" |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 20 | #include "disk-io.h" |
Chris Mason | 9f5fae2 | 2007-03-20 14:38:32 -0400 | [diff] [blame] | 21 | #include "transaction.h" |
Chris Mason | 1de037a | 2007-05-29 15:17:08 -0400 | [diff] [blame] | 22 | #include "print-tree.h" |
Chris Mason | 1e1d270 | 2007-03-15 19:03:33 -0400 | [diff] [blame] | 23 | |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 24 | #define MAX_CSUM_ITEMS(r) ((((BTRFS_LEAF_DATA_SIZE(r) - \ |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 25 | sizeof(struct btrfs_item) * 2) / \ |
| 26 | BTRFS_CRC32_SIZE) - 1)) |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 27 | int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 28 | struct btrfs_root *root, |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 29 | u64 objectid, u64 pos, |
Chris Mason | 3a68637 | 2007-05-24 13:35:57 -0400 | [diff] [blame] | 30 | u64 offset, u64 disk_num_blocks, |
| 31 | u64 num_blocks) |
Chris Mason | 9f5fae2 | 2007-03-20 14:38:32 -0400 | [diff] [blame] | 32 | { |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 33 | int ret = 0; |
| 34 | struct btrfs_file_extent_item *item; |
| 35 | struct btrfs_key file_key; |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 36 | struct btrfs_path *path; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 37 | struct extent_buffer *leaf; |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 38 | |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 39 | path = btrfs_alloc_path(); |
| 40 | BUG_ON(!path); |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 41 | file_key.objectid = objectid; |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 42 | file_key.offset = pos; |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 43 | btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY); |
| 44 | |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 45 | ret = btrfs_insert_empty_item(trans, root, path, &file_key, |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 46 | sizeof(*item)); |
Chris Mason | 54aa1f4 | 2007-06-22 14:16:25 -0400 | [diff] [blame] | 47 | if (ret < 0) |
| 48 | goto out; |
Chris Mason | 9773a78 | 2007-03-27 11:26:26 -0400 | [diff] [blame] | 49 | BUG_ON(ret); |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 50 | leaf = path->nodes[0]; |
| 51 | item = btrfs_item_ptr(leaf, path->slots[0], |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 52 | struct btrfs_file_extent_item); |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 53 | btrfs_set_file_extent_disk_blocknr(leaf, item, offset); |
| 54 | btrfs_set_file_extent_disk_num_blocks(leaf, item, disk_num_blocks); |
| 55 | btrfs_set_file_extent_offset(leaf, item, 0); |
| 56 | btrfs_set_file_extent_num_blocks(leaf, item, num_blocks); |
| 57 | btrfs_set_file_extent_generation(leaf, item, trans->transid); |
| 58 | btrfs_set_file_extent_type(leaf, item, BTRFS_FILE_EXTENT_REG); |
| 59 | btrfs_mark_buffer_dirty(leaf); |
Chris Mason | 54aa1f4 | 2007-06-22 14:16:25 -0400 | [diff] [blame] | 60 | out: |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 61 | btrfs_free_path(path); |
Chris Mason | 54aa1f4 | 2007-06-22 14:16:25 -0400 | [diff] [blame] | 62 | return ret; |
Chris Mason | 9f5fae2 | 2007-03-20 14:38:32 -0400 | [diff] [blame] | 63 | } |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 64 | |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 65 | struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans, |
| 66 | struct btrfs_root *root, |
| 67 | struct btrfs_path *path, |
| 68 | u64 objectid, u64 offset, |
| 69 | int cow) |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 70 | { |
| 71 | int ret; |
| 72 | struct btrfs_key file_key; |
| 73 | struct btrfs_key found_key; |
| 74 | struct btrfs_csum_item *item; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 75 | struct extent_buffer *leaf; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 76 | u64 csum_offset = 0; |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 77 | int csums_in_item; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 78 | |
| 79 | file_key.objectid = objectid; |
| 80 | file_key.offset = offset; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 81 | btrfs_set_key_type(&file_key, BTRFS_CSUM_ITEM_KEY); |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 82 | ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 83 | if (ret < 0) |
| 84 | goto fail; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 85 | leaf = path->nodes[0]; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 86 | if (ret > 0) { |
| 87 | ret = 1; |
Chris Mason | 70b2bef | 2007-04-17 15:39:32 -0400 | [diff] [blame] | 88 | if (path->slots[0] == 0) |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 89 | goto fail; |
| 90 | path->slots[0]--; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 91 | btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 92 | if (btrfs_key_type(&found_key) != BTRFS_CSUM_ITEM_KEY || |
| 93 | found_key.objectid != objectid) { |
| 94 | goto fail; |
| 95 | } |
| 96 | csum_offset = (offset - found_key.offset) >> |
| 97 | root->fs_info->sb->s_blocksize_bits; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 98 | csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]); |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 99 | csums_in_item /= BTRFS_CRC32_SIZE; |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 100 | |
| 101 | if (csum_offset >= csums_in_item) { |
| 102 | ret = -EFBIG; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 103 | goto fail; |
| 104 | } |
| 105 | } |
| 106 | item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 107 | item = (struct btrfs_csum_item *)((unsigned char *)item + |
| 108 | csum_offset * BTRFS_CRC32_SIZE); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 109 | return item; |
| 110 | fail: |
| 111 | if (ret > 0) |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 112 | ret = -ENOENT; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 113 | return ERR_PTR(ret); |
| 114 | } |
| 115 | |
| 116 | |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 117 | int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, |
| 118 | struct btrfs_root *root, |
| 119 | struct btrfs_path *path, u64 objectid, |
Chris Mason | 9773a78 | 2007-03-27 11:26:26 -0400 | [diff] [blame] | 120 | u64 offset, int mod) |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 121 | { |
| 122 | int ret; |
| 123 | struct btrfs_key file_key; |
| 124 | int ins_len = mod < 0 ? -1 : 0; |
| 125 | int cow = mod != 0; |
| 126 | |
| 127 | file_key.objectid = objectid; |
Chris Mason | 70b2bef | 2007-04-17 15:39:32 -0400 | [diff] [blame] | 128 | file_key.offset = offset; |
Chris Mason | dee26a9 | 2007-03-26 16:00:06 -0400 | [diff] [blame] | 129 | btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY); |
| 130 | ret = btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); |
| 131 | return ret; |
| 132 | } |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 133 | |
| 134 | int btrfs_csum_file_block(struct btrfs_trans_handle *trans, |
| 135 | struct btrfs_root *root, |
| 136 | u64 objectid, u64 offset, |
| 137 | char *data, size_t len) |
| 138 | { |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 139 | return 0; |
| 140 | #if 0 |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 141 | int ret; |
| 142 | struct btrfs_key file_key; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 143 | struct btrfs_key found_key; |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 144 | struct btrfs_path *path; |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 145 | struct btrfs_csum_item *item; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 146 | struct extent_buffer *leaf; |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 147 | u64 csum_offset; |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 148 | |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 149 | path = btrfs_alloc_path(); |
| 150 | BUG_ON(!path); |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 151 | |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 152 | file_key.objectid = objectid; |
| 153 | file_key.offset = offset; |
| 154 | file_key.flags = 0; |
| 155 | btrfs_set_key_type(&file_key, BTRFS_CSUM_ITEM_KEY); |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 156 | |
| 157 | item = btrfs_lookup_csum(trans, root, path, objectid, offset, 1); |
| 158 | if (!IS_ERR(item)) |
| 159 | goto found; |
| 160 | ret = PTR_ERR(item); |
| 161 | if (ret == -EFBIG) { |
| 162 | u32 item_size; |
| 163 | /* we found one, but it isn't big enough yet */ |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 164 | leaf = path->nodes[0]; |
| 165 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 166 | if ((item_size / BTRFS_CRC32_SIZE) >= MAX_CSUM_ITEMS(root)) { |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 167 | /* already at max size, make a new one */ |
| 168 | goto insert; |
| 169 | } |
| 170 | } else { |
| 171 | /* we didn't find a csum item, insert one */ |
| 172 | goto insert; |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | * at this point, we know the tree has an item, but it isn't big |
| 177 | * enough yet to put our csum in. Grow it |
| 178 | */ |
| 179 | btrfs_release_path(root, path); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 180 | ret = btrfs_search_slot(trans, root, &file_key, path, |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 181 | BTRFS_CRC32_SIZE, 1); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 182 | if (ret < 0) |
| 183 | goto fail; |
| 184 | if (ret == 0) { |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 185 | BUG(); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 186 | } |
| 187 | if (path->slots[0] == 0) { |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 188 | goto insert; |
| 189 | } |
| 190 | path->slots[0]--; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 191 | leaf = path->nodes[0]; |
| 192 | btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 193 | csum_offset = (offset - found_key.offset) >> |
| 194 | root->fs_info->sb->s_blocksize_bits; |
| 195 | if (btrfs_key_type(&found_key) != BTRFS_CSUM_ITEM_KEY || |
| 196 | found_key.objectid != objectid || |
| 197 | csum_offset >= MAX_CSUM_ITEMS(root)) { |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 198 | goto insert; |
| 199 | } |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 200 | if (csum_offset >= btrfs_item_size_nr(leaf, path->slots[0]) / |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 201 | BTRFS_CRC32_SIZE) { |
| 202 | u32 diff = (csum_offset + 1) * BTRFS_CRC32_SIZE; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 203 | diff = diff - btrfs_item_size_nr(leaf, path->slots[0]); |
Chris Mason | 3a68637 | 2007-05-24 13:35:57 -0400 | [diff] [blame] | 204 | if (diff != BTRFS_CRC32_SIZE) |
| 205 | goto insert; |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 206 | ret = btrfs_extend_item(trans, root, path, diff); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 207 | BUG_ON(ret); |
| 208 | goto csum; |
| 209 | } |
| 210 | |
| 211 | insert: |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 212 | btrfs_release_path(root, path); |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 213 | csum_offset = 0; |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 214 | ret = btrfs_insert_empty_item(trans, root, path, &file_key, |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 215 | BTRFS_CRC32_SIZE); |
Chris Mason | 54aa1f4 | 2007-06-22 14:16:25 -0400 | [diff] [blame] | 216 | if (ret < 0) |
| 217 | goto fail; |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 218 | if (ret != 0) { |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 219 | WARN_ON(1); |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 220 | goto fail; |
Chris Mason | a429e51 | 2007-04-18 16:15:28 -0400 | [diff] [blame] | 221 | } |
Chris Mason | 6567e83 | 2007-04-16 09:22:45 -0400 | [diff] [blame] | 222 | csum: |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 223 | leaf = path->nodes[0]; |
| 224 | item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 225 | ret = 0; |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 226 | item = (struct btrfs_csum_item *)((unsigned char *)item + |
| 227 | csum_offset * BTRFS_CRC32_SIZE); |
Chris Mason | b18c668 | 2007-04-17 13:26:50 -0400 | [diff] [blame] | 228 | found: |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 229 | /* FIXME!!!!!!!!!!!! */ |
Chris Mason | 509659c | 2007-05-10 12:36:17 -0400 | [diff] [blame] | 230 | ret = btrfs_csum_data(root, data, len, &item->csum); |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 231 | btrfs_mark_buffer_dirty(path->nodes[0]); |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 232 | fail: |
Chris Mason | 5caf2a0 | 2007-04-02 11:20:42 -0400 | [diff] [blame] | 233 | btrfs_release_path(root, path); |
| 234 | btrfs_free_path(path); |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 235 | return ret; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 236 | #endif |
Chris Mason | f254e52 | 2007-03-29 15:15:27 -0400 | [diff] [blame] | 237 | } |
| 238 | |
Chris Mason | 1de037a | 2007-05-29 15:17:08 -0400 | [diff] [blame] | 239 | int btrfs_csum_truncate(struct btrfs_trans_handle *trans, |
| 240 | struct btrfs_root *root, struct btrfs_path *path, |
| 241 | u64 isize) |
| 242 | { |
| 243 | struct btrfs_key key; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 244 | struct extent_buffer *leaf = path->nodes[0]; |
Chris Mason | 1de037a | 2007-05-29 15:17:08 -0400 | [diff] [blame] | 245 | int slot = path->slots[0]; |
| 246 | int ret; |
| 247 | u32 new_item_size; |
| 248 | u64 new_item_span; |
| 249 | u64 blocks; |
| 250 | |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 251 | btrfs_item_key_to_cpu(leaf, &key, slot); |
Chris Mason | 1de037a | 2007-05-29 15:17:08 -0400 | [diff] [blame] | 252 | if (isize <= key.offset) |
| 253 | return 0; |
| 254 | new_item_span = isize - key.offset; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 255 | blocks = (new_item_span + root->sectorsize - 1) >> |
Chris Mason | 84f54cf | 2007-06-12 07:43:08 -0400 | [diff] [blame] | 256 | root->fs_info->sb->s_blocksize_bits; |
Chris Mason | 1de037a | 2007-05-29 15:17:08 -0400 | [diff] [blame] | 257 | new_item_size = blocks * BTRFS_CRC32_SIZE; |
Chris Mason | 5f39d39 | 2007-10-15 16:14:19 -0400 | [diff] [blame] | 258 | if (new_item_size >= btrfs_item_size_nr(leaf, slot)) |
Chris Mason | 1de037a | 2007-05-29 15:17:08 -0400 | [diff] [blame] | 259 | return 0; |
| 260 | ret = btrfs_truncate_item(trans, root, path, new_item_size); |
| 261 | BUG_ON(ret); |
| 262 | return ret; |
| 263 | } |
| 264 | |