Change btrfs_map_block to return a structure with mappings for all stripes
[btrfs-progs-unstable.git] / disk-io.c
blobd49f2cea2494d4c6b691f86492fd5c5541b98643
1 /*
2 * Copyright (C) 2007 Oracle. All rights reserved.
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.
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.
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.
19 #define _XOPEN_SOURCE 600
20 #define __USE_XOPEN2K
21 #define _GNU_SOURCE 1
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <fcntl.h>
27 #include <unistd.h>
28 #include "kerncompat.h"
29 #include "radix-tree.h"
30 #include "ctree.h"
31 #include "disk-io.h"
32 #include "volumes.h"
33 #include "transaction.h"
34 #include "crc32c.h"
35 #include "utils.h"
36 #include "print-tree.h"
38 static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
40 if (buf->start != btrfs_header_bytenr(buf))
41 BUG();
43 if (memcmp_extent_buffer(buf, root->fs_info->fsid,
44 (unsigned long)btrfs_header_fsid(buf),
45 BTRFS_FSID_SIZE))
46 BUG();
47 return 0;
50 u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
52 return crc32c(seed, data, len);
55 void btrfs_csum_final(u32 crc, char *result)
57 *(__le32 *)result = ~cpu_to_le32(crc);
60 static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
61 int verify)
63 char result[BTRFS_CRC32_SIZE];
64 u32 len;
65 u32 crc = ~(u32)0;
67 len = buf->len - BTRFS_CSUM_SIZE;
68 crc = crc32c(crc, buf->data + BTRFS_CSUM_SIZE, len);
69 btrfs_csum_final(crc, result);
71 if (verify) {
72 if (memcmp_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE)) {
73 printk("checksum verify failed on %llu\n",
74 (unsigned long long)buf->start);
75 return 1;
77 } else {
78 write_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE);
80 return 0;
83 struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
84 u64 bytenr, u32 blocksize)
86 return find_extent_buffer(&root->fs_info->extent_cache,
87 bytenr, blocksize);
90 struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
91 u64 bytenr, u32 blocksize)
93 return alloc_extent_buffer(&root->fs_info->extent_cache, bytenr,
94 blocksize);
97 int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize)
99 int ret;
100 int dev_nr;
101 struct extent_buffer *eb;
102 u64 length;
103 struct btrfs_multi_bio *multi = NULL;
104 struct btrfs_device *device;
106 eb = btrfs_find_tree_block(root, bytenr, blocksize);
107 if (eb && btrfs_buffer_uptodate(eb)) {
108 free_extent_buffer(eb);
109 return 0;
112 dev_nr = 0;
113 length = blocksize;
114 ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
115 bytenr, &length, &multi);
116 BUG_ON(ret);
117 device = multi->stripes[0].dev;
118 device->total_ios++;
119 blocksize = min(blocksize, (u32)(64 * 1024));
120 readahead(device->fd, multi->stripes[0].physical, blocksize);
121 kfree(multi);
122 return 0;
125 struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
126 u32 blocksize)
128 int ret;
129 int dev_nr;
130 struct extent_buffer *eb;
131 u64 length;
132 struct btrfs_multi_bio *multi = NULL;
133 struct btrfs_device *device;
135 eb = btrfs_find_create_tree_block(root, bytenr, blocksize);
136 if (!eb)
137 return NULL;
139 if (btrfs_buffer_uptodate(eb))
140 return eb;
142 dev_nr = 0;
143 length = blocksize;
144 ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
145 eb->start, &length, &multi);
146 BUG_ON(ret);
147 device = multi->stripes[0].dev;
148 eb->fd = device->fd;
149 device->total_ios++;
150 eb->dev_bytenr = multi->stripes[0].physical;
151 ret = read_extent_from_disk(eb);
152 if (ret) {
153 free_extent_buffer(eb);
154 return NULL;
156 btrfs_set_buffer_uptodate(eb);
157 kfree(multi);
158 return eb;
161 int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
162 struct extent_buffer *eb)
164 int ret;
165 int dev_nr;
166 u64 length;
167 struct btrfs_multi_bio *multi = NULL;
169 if (check_tree_block(root, eb))
170 BUG();
171 if (!btrfs_buffer_uptodate(eb))
172 BUG();
174 btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
175 csum_tree_block(root, eb, 0);
177 dev_nr = 0;
178 length = eb->len;
179 ret = btrfs_map_block(&root->fs_info->mapping_tree, WRITE,
180 eb->start, &length, &multi);
181 while(dev_nr < multi->num_stripes) {
182 BUG_ON(ret);
183 eb->fd = multi->stripes[dev_nr].dev->fd;
184 eb->dev_bytenr = multi->stripes[dev_nr].physical;
185 multi->stripes[dev_nr].dev->total_ios++;
186 dev_nr++;
187 ret = write_extent_to_disk(eb);
188 BUG_ON(ret);
190 kfree(multi);
191 return 0;
194 static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
195 u32 stripesize, struct btrfs_root *root,
196 struct btrfs_fs_info *fs_info, u64 objectid)
198 root->node = NULL;
199 root->commit_root = NULL;
200 root->sectorsize = sectorsize;
201 root->nodesize = nodesize;
202 root->leafsize = leafsize;
203 root->stripesize = stripesize;
204 root->ref_cows = 0;
205 root->track_dirty = 0;
207 root->fs_info = fs_info;
208 root->objectid = objectid;
209 root->last_trans = 0;
210 root->highest_inode = 0;
211 root->last_inode_alloc = 0;
213 INIT_LIST_HEAD(&root->dirty_list);
214 memset(&root->root_key, 0, sizeof(root->root_key));
215 memset(&root->root_item, 0, sizeof(root->root_item));
216 root->root_key.objectid = objectid;
217 return 0;
220 static int update_cowonly_root(struct btrfs_trans_handle *trans,
221 struct btrfs_root *root)
223 int ret;
224 u64 old_root_bytenr;
225 struct btrfs_root *tree_root = root->fs_info->tree_root;
227 btrfs_write_dirty_block_groups(trans, root);
228 while(1) {
229 old_root_bytenr = btrfs_root_bytenr(&root->root_item);
230 if (old_root_bytenr == root->node->start)
231 break;
232 btrfs_set_root_bytenr(&root->root_item,
233 root->node->start);
234 root->root_item.level = btrfs_header_level(root->node);
235 ret = btrfs_update_root(trans, tree_root,
236 &root->root_key,
237 &root->root_item);
238 BUG_ON(ret);
239 btrfs_write_dirty_block_groups(trans, root);
241 return 0;
244 static int commit_tree_roots(struct btrfs_trans_handle *trans,
245 struct btrfs_fs_info *fs_info)
247 struct btrfs_root *root;
248 struct list_head *next;
250 while(!list_empty(&fs_info->dirty_cowonly_roots)) {
251 next = fs_info->dirty_cowonly_roots.next;
252 list_del_init(next);
253 root = list_entry(next, struct btrfs_root, dirty_list);
254 update_cowonly_root(trans, root);
256 return 0;
259 static int __commit_transaction(struct btrfs_trans_handle *trans,
260 struct btrfs_root *root)
262 u64 start;
263 u64 end;
264 struct extent_buffer *eb;
265 struct extent_io_tree *tree = &root->fs_info->extent_cache;
266 int ret;
268 while(1) {
269 ret = find_first_extent_bit(tree, 0, &start, &end,
270 EXTENT_DIRTY);
271 if (ret)
272 break;
273 while(start <= end) {
274 eb = find_first_extent_buffer(tree, start);
275 BUG_ON(!eb || eb->start != start);
276 ret = write_tree_block(trans, root, eb);
277 BUG_ON(ret);
278 start += eb->len;
279 clear_extent_buffer_dirty(eb);
280 free_extent_buffer(eb);
283 return 0;
286 int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
287 struct btrfs_root *root)
289 int ret = 0;
290 struct btrfs_root *new_root = NULL;
291 struct btrfs_fs_info *fs_info = root->fs_info;
293 if (root->commit_root == root->node)
294 goto commit_tree;
296 new_root = malloc(sizeof(*new_root));
297 if (!new_root)
298 return -ENOMEM;
299 memcpy(new_root, root, sizeof(*new_root));
300 new_root->node = root->commit_root;
301 root->commit_root = NULL;
303 root->root_key.offset = trans->transid;
304 btrfs_set_root_bytenr(&root->root_item, root->node->start);
305 root->root_item.level = btrfs_header_level(root->node);
306 ret = btrfs_insert_root(trans, fs_info->tree_root,
307 &root->root_key, &root->root_item);
308 BUG_ON(ret);
310 btrfs_set_root_refs(&new_root->root_item, 0);
311 ret = btrfs_update_root(trans, root->fs_info->tree_root,
312 &new_root->root_key, &new_root->root_item);
313 BUG_ON(ret);
315 ret = commit_tree_roots(trans, fs_info);
316 BUG_ON(ret);
317 ret = __commit_transaction(trans, root);
318 BUG_ON(ret);
319 write_ctree_super(trans, root);
320 btrfs_finish_extent_commit(trans, fs_info->extent_root,
321 &fs_info->pinned_extents);
322 btrfs_free_transaction(root, trans);
323 fs_info->running_transaction = NULL;
325 trans = btrfs_start_transaction(root, 1);
326 ret = btrfs_drop_snapshot(trans, new_root);
327 BUG_ON(ret);
328 ret = btrfs_del_root(trans, fs_info->tree_root, &new_root->root_key);
329 BUG_ON(ret);
330 commit_tree:
331 ret = commit_tree_roots(trans, fs_info);
332 BUG_ON(ret);
333 ret = __commit_transaction(trans, root);
334 BUG_ON(ret);
335 write_ctree_super(trans, root);
336 btrfs_finish_extent_commit(trans, fs_info->extent_root,
337 &fs_info->pinned_extents);
338 btrfs_free_transaction(root, trans);
339 free_extent_buffer(root->commit_root);
340 root->commit_root = NULL;
341 fs_info->running_transaction = NULL;
342 if (new_root) {
343 free_extent_buffer(new_root->node);
344 free(new_root);
346 return 0;
349 static int find_and_setup_root(struct btrfs_root *tree_root,
350 struct btrfs_fs_info *fs_info,
351 u64 objectid, struct btrfs_root *root)
353 int ret;
354 u32 blocksize;
356 __setup_root(tree_root->nodesize, tree_root->leafsize,
357 tree_root->sectorsize, tree_root->stripesize,
358 root, fs_info, objectid);
359 ret = btrfs_find_last_root(tree_root, objectid,
360 &root->root_item, &root->root_key);
361 BUG_ON(ret);
363 blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
364 root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
365 blocksize);
366 BUG_ON(!root->node);
367 return 0;
370 int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
372 if (root->node)
373 free_extent_buffer(root->node);
374 if (root->commit_root)
375 free_extent_buffer(root->commit_root);
377 free(root);
378 return 0;
381 struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
382 struct btrfs_key *location)
384 struct btrfs_root *root;
385 struct btrfs_root *tree_root = fs_info->tree_root;
386 struct btrfs_path *path;
387 struct extent_buffer *l;
388 u32 blocksize;
389 int ret = 0;
391 root = malloc(sizeof(*root));
392 if (!root)
393 return ERR_PTR(-ENOMEM);
394 memset(root, 0, sizeof(*root));
395 if (location->offset == (u64)-1) {
396 ret = find_and_setup_root(tree_root, fs_info,
397 location->objectid, root);
398 if (ret) {
399 free(root);
400 return ERR_PTR(ret);
402 goto insert;
405 __setup_root(tree_root->nodesize, tree_root->leafsize,
406 tree_root->sectorsize, tree_root->stripesize,
407 root, fs_info, location->objectid);
409 path = btrfs_alloc_path();
410 BUG_ON(!path);
411 ret = btrfs_search_slot(NULL, tree_root, location, path, 0, 0);
412 if (ret != 0) {
413 if (ret > 0)
414 ret = -ENOENT;
415 goto out;
417 l = path->nodes[0];
418 read_extent_buffer(l, &root->root_item,
419 btrfs_item_ptr_offset(l, path->slots[0]),
420 sizeof(root->root_item));
421 memcpy(&root->root_key, location, sizeof(*location));
422 ret = 0;
423 out:
424 btrfs_release_path(root, path);
425 btrfs_free_path(path);
426 if (ret) {
427 free(root);
428 return ERR_PTR(ret);
430 blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
431 root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
432 blocksize);
433 BUG_ON(!root->node);
434 insert:
435 root->ref_cows = 1;
436 return root;
439 struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr)
441 int fp;
443 fp = open(filename, O_CREAT | O_RDWR, 0600);
444 if (fp < 0) {
445 return NULL;
447 return open_ctree_fd(fp, filename, sb_bytenr);
450 struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr)
452 u32 sectorsize;
453 u32 nodesize;
454 u32 leafsize;
455 u32 blocksize;
456 u32 stripesize;
457 struct btrfs_root *root = malloc(sizeof(struct btrfs_root));
458 struct btrfs_root *tree_root = malloc(sizeof(struct btrfs_root));
459 struct btrfs_root *extent_root = malloc(sizeof(struct btrfs_root));
460 struct btrfs_root *chunk_root = malloc(sizeof(struct btrfs_root));
461 struct btrfs_root *dev_root = malloc(sizeof(struct btrfs_root));
462 struct btrfs_fs_info *fs_info = malloc(sizeof(*fs_info));
463 int ret;
464 struct btrfs_super_block *disk_super;
465 struct btrfs_fs_devices *fs_devices = NULL;
466 u64 total_devs;
468 if (sb_bytenr == 0)
469 sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
471 ret = btrfs_scan_one_device(fp, path, &fs_devices,
472 &total_devs, sb_bytenr);
474 if (ret) {
475 fprintf(stderr, "No valid Btrfs found on %s\n", path);
476 return NULL;
478 fprintf(stderr, "found Btrfs on %s with %lu devices\n", path,
479 (unsigned long)total_devs);
481 if (total_devs != 1) {
482 ret = btrfs_scan_for_fsid(fs_devices, total_devs, 1);
483 BUG_ON(ret);
486 memset(fs_info, 0, sizeof(*fs_info));
487 fs_info->fp = fs_devices->lowest_bdev;
488 fs_info->fs_root = root;
489 fs_info->tree_root = tree_root;
490 fs_info->extent_root = extent_root;
491 fs_info->chunk_root = chunk_root;
492 fs_info->dev_root = dev_root;
494 extent_io_tree_init(&fs_info->extent_cache);
495 extent_io_tree_init(&fs_info->free_space_cache);
496 extent_io_tree_init(&fs_info->block_group_cache);
497 extent_io_tree_init(&fs_info->pinned_extents);
498 extent_io_tree_init(&fs_info->pending_del);
499 extent_io_tree_init(&fs_info->extent_ins);
501 cache_tree_init(&fs_info->mapping_tree.cache_tree);
503 mutex_init(&fs_info->fs_mutex);
504 fs_info->fs_devices = fs_devices;
505 INIT_LIST_HEAD(&fs_info->dirty_cowonly_roots);
506 INIT_LIST_HEAD(&fs_info->space_info);
508 __setup_root(4096, 4096, 4096, 4096, tree_root,
509 fs_info, BTRFS_ROOT_TREE_OBJECTID);
511 ret = btrfs_open_devices(fs_devices, O_RDWR);
512 BUG_ON(ret);
514 fs_info->sb_buffer = btrfs_find_create_tree_block(tree_root, sb_bytenr,
515 4096);
516 BUG_ON(!fs_info->sb_buffer);
517 fs_info->sb_buffer->fd = fs_devices->lowest_bdev;
518 fs_info->sb_buffer->dev_bytenr = sb_bytenr;
519 ret = read_extent_from_disk(fs_info->sb_buffer);
520 BUG_ON(ret);
521 btrfs_set_buffer_uptodate(fs_info->sb_buffer);
523 read_extent_buffer(fs_info->sb_buffer, &fs_info->super_copy, 0,
524 sizeof(fs_info->super_copy));
525 read_extent_buffer(fs_info->sb_buffer, fs_info->fsid,
526 (unsigned long)btrfs_super_fsid(fs_info->sb_buffer),
527 BTRFS_FSID_SIZE);
529 disk_super = &fs_info->super_copy;
530 if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
531 sizeof(disk_super->magic))) {
532 printk("No valid btrfs found\n");
533 BUG_ON(1);
535 nodesize = btrfs_super_nodesize(disk_super);
536 leafsize = btrfs_super_leafsize(disk_super);
537 sectorsize = btrfs_super_sectorsize(disk_super);
538 stripesize = btrfs_super_stripesize(disk_super);
539 tree_root->nodesize = nodesize;
540 tree_root->leafsize = leafsize;
541 tree_root->sectorsize = sectorsize;
542 tree_root->stripesize = stripesize;
544 ret = btrfs_read_super_device(tree_root, fs_info->sb_buffer);
545 BUG_ON(ret);
546 ret = btrfs_read_sys_array(tree_root);
547 BUG_ON(ret);
548 blocksize = btrfs_level_size(tree_root,
549 btrfs_super_chunk_root_level(disk_super));
551 __setup_root(nodesize, leafsize, sectorsize, stripesize,
552 chunk_root, fs_info, BTRFS_CHUNK_TREE_OBJECTID);
554 chunk_root->node = read_tree_block(chunk_root,
555 btrfs_super_chunk_root(disk_super),
556 blocksize);
558 BUG_ON(!chunk_root->node);
560 ret = btrfs_read_chunk_tree(chunk_root);
561 BUG_ON(ret);
563 blocksize = btrfs_level_size(tree_root,
564 btrfs_super_root_level(disk_super));
566 tree_root->node = read_tree_block(tree_root,
567 btrfs_super_root(disk_super),
568 blocksize);
569 BUG_ON(!tree_root->node);
570 ret = find_and_setup_root(tree_root, fs_info,
571 BTRFS_EXTENT_TREE_OBJECTID, extent_root);
572 BUG_ON(ret);
573 extent_root->track_dirty = 1;
575 ret = find_and_setup_root(tree_root, fs_info,
576 BTRFS_DEV_TREE_OBJECTID, dev_root);
577 BUG_ON(ret);
578 dev_root->track_dirty = 1;
580 ret = find_and_setup_root(tree_root, fs_info,
581 BTRFS_FS_TREE_OBJECTID, root);
582 BUG_ON(ret);
583 root->ref_cows = 1;
584 fs_info->generation = btrfs_super_generation(disk_super) + 1;
585 btrfs_read_block_groups(root);
587 fs_info->data_alloc_profile = (u64)-1;
588 fs_info->metadata_alloc_profile = (u64)-1;
589 fs_info->system_alloc_profile = fs_info->metadata_alloc_profile;
591 return root;
594 int write_ctree_super(struct btrfs_trans_handle *trans,
595 struct btrfs_root *root)
597 int ret;
598 struct btrfs_root *tree_root = root->fs_info->tree_root;
599 struct btrfs_root *chunk_root = root->fs_info->chunk_root;
600 btrfs_set_super_generation(&root->fs_info->super_copy,
601 trans->transid);
602 btrfs_set_super_root(&root->fs_info->super_copy,
603 tree_root->node->start);
604 btrfs_set_super_root_level(&root->fs_info->super_copy,
605 btrfs_header_level(tree_root->node));
606 btrfs_set_super_chunk_root(&root->fs_info->super_copy,
607 chunk_root->node->start);
608 btrfs_set_super_chunk_root_level(&root->fs_info->super_copy,
609 btrfs_header_level(chunk_root->node));
610 write_extent_buffer(root->fs_info->sb_buffer,
611 &root->fs_info->super_copy, 0,
612 sizeof(root->fs_info->super_copy));
613 ret = write_tree_block(trans, root, root->fs_info->sb_buffer);
614 if (ret)
615 fprintf(stderr, "failed to write new super block err %d\n", ret);
616 return ret;
619 static int close_all_devices(struct btrfs_fs_info *fs_info)
621 struct list_head *list;
622 struct list_head *next;
623 struct btrfs_device *device;
625 return 0;
627 list = &fs_info->fs_devices->devices;
628 list_for_each(next, list) {
629 device = list_entry(next, struct btrfs_device, dev_list);
630 // close(device->fd);
632 return 0;
635 int close_ctree(struct btrfs_root *root)
637 int ret;
638 struct btrfs_trans_handle *trans;
639 struct btrfs_fs_info *fs_info = root->fs_info;
641 trans = btrfs_start_transaction(root, 1);
642 btrfs_commit_transaction(trans, root);
643 trans = btrfs_start_transaction(root, 1);
644 ret = commit_tree_roots(trans, root->fs_info);
645 BUG_ON(ret);
646 ret = __commit_transaction(trans, root);
647 BUG_ON(ret);
648 write_ctree_super(trans, root);
649 btrfs_free_transaction(root, trans);
650 btrfs_free_block_groups(root->fs_info);
651 close(root->fs_info->fp);
652 if (root->node)
653 free_extent_buffer(root->node);
654 if (root->fs_info->extent_root->node)
655 free_extent_buffer(root->fs_info->extent_root->node);
656 if (root->fs_info->tree_root->node)
657 free_extent_buffer(root->fs_info->tree_root->node);
658 free_extent_buffer(root->commit_root);
659 free_extent_buffer(root->fs_info->sb_buffer);
661 if (root->fs_info->chunk_root->node);
662 free_extent_buffer(root->fs_info->chunk_root->node);
664 if (root->fs_info->dev_root->node);
665 free_extent_buffer(root->fs_info->dev_root->node);
667 close_all_devices(root->fs_info);
668 extent_io_tree_cleanup(&fs_info->extent_cache);
669 extent_io_tree_cleanup(&fs_info->free_space_cache);
670 extent_io_tree_cleanup(&fs_info->block_group_cache);
671 extent_io_tree_cleanup(&fs_info->pinned_extents);
672 extent_io_tree_cleanup(&fs_info->pending_del);
673 extent_io_tree_cleanup(&fs_info->extent_ins);
675 free(fs_info->tree_root);
676 free(fs_info->extent_root);
677 free(fs_info->fs_root);
678 free(fs_info->chunk_root);
679 free(fs_info->dev_root);
680 free(fs_info);
682 return 0;
685 int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
686 struct extent_buffer *eb)
688 return clear_extent_buffer_dirty(eb);
691 int wait_on_tree_block_writeback(struct btrfs_root *root,
692 struct extent_buffer *eb)
694 return 0;
697 void btrfs_mark_buffer_dirty(struct extent_buffer *eb)
699 set_extent_buffer_dirty(eb);
702 int btrfs_buffer_uptodate(struct extent_buffer *eb)
704 return extent_buffer_uptodate(eb);
707 int btrfs_set_buffer_uptodate(struct extent_buffer *eb)
709 return set_extent_buffer_uptodate(eb);