btrfs-progs: Fix printf format casting errors
[platform/upstream/btrfs-progs.git] / disk-io.c
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
19 #define _XOPEN_SOURCE 600
20 #define __USE_XOPEN2K
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <fcntl.h>
26 #include <unistd.h>
27 #include "kerncompat.h"
28 #include "radix-tree.h"
29 #include "ctree.h"
30 #include "disk-io.h"
31 #include "volumes.h"
32 #include "transaction.h"
33 #include "crc32c.h"
34 #include "utils.h"
35
36 int btrfs_map_bh_to_logical(struct btrfs_root *root, struct extent_buffer *buf,
37                             u64 logical)
38 {
39         u64 physical;
40         u64 length;
41         struct btrfs_device *device;
42         int ret;
43
44         ret = btrfs_map_block(&root->fs_info->mapping_tree, logical, &physical,
45                               &length, &device);
46         BUG_ON(ret);
47         buf->fd = device->fd;
48         buf->dev_bytenr = physical;
49         return 0;
50 }
51
52 static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
53 {
54         if (buf->start != btrfs_header_bytenr(buf))
55                 BUG();
56
57         if (memcmp_extent_buffer(buf, root->fs_info->fsid,
58                                  (unsigned long)btrfs_header_fsid(buf),
59                                  BTRFS_FSID_SIZE))
60                 BUG();
61         return 0;
62 }
63
64 u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
65 {
66         return crc32c(seed, data, len);
67 }
68
69 void btrfs_csum_final(u32 crc, char *result)
70 {
71         *(__le32 *)result = ~cpu_to_le32(crc);
72 }
73
74 static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
75                            int verify)
76 {
77         char result[BTRFS_CRC32_SIZE];
78         u32 len;
79         u32 crc = ~(u32)0;
80
81         len = buf->len - BTRFS_CSUM_SIZE;
82         crc = crc32c(crc, buf->data + BTRFS_CSUM_SIZE, len);
83         btrfs_csum_final(crc, result);
84
85         if (verify) {
86                 if (memcmp_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE)) {
87                         printk("checksum verify failed on %llu\n",
88                                 (unsigned long long)buf->start);
89                         return 1;
90                 }
91         } else {
92                 write_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE);
93         }
94         return 0;
95 }
96
97 struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
98                                             u64 bytenr, u32 blocksize)
99 {
100         return find_extent_buffer(&root->fs_info->extent_cache,
101                                   bytenr, blocksize);
102 }
103
104 struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
105                                                  u64 bytenr, u32 blocksize)
106 {
107         return alloc_extent_buffer(&root->fs_info->extent_cache, bytenr,
108                                    blocksize);
109 }
110
111 int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize)
112 {
113         return 0;
114 }
115
116 struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
117                                      u32 blocksize)
118 {
119         int ret;
120         struct extent_buffer *eb;
121
122         eb = btrfs_find_create_tree_block(root, bytenr, blocksize);
123         if (!eb)
124                 return NULL;
125         if (!btrfs_buffer_uptodate(eb)) {
126                 btrfs_map_bh_to_logical(root, eb, eb->start);
127                 ret = read_extent_from_disk(eb);
128                 if (ret) {
129                         free_extent_buffer(eb);
130                         return NULL;
131                 }
132                 btrfs_set_buffer_uptodate(eb);
133         }
134         return eb;
135 }
136
137 int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
138                      struct extent_buffer *eb)
139 {
140         if (check_tree_block(root, eb))
141                 BUG();
142         if (!btrfs_buffer_uptodate(eb))
143                 BUG();
144
145         btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
146         btrfs_map_bh_to_logical(root, eb, eb->start);
147         csum_tree_block(root, eb, 0);
148         return write_extent_to_disk(eb);
149 }
150
151 static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
152                         u32 stripesize, struct btrfs_root *root,
153                         struct btrfs_fs_info *fs_info, u64 objectid)
154 {
155         root->node = NULL;
156         root->commit_root = NULL;
157         root->sectorsize = sectorsize;
158         root->nodesize = nodesize;
159         root->leafsize = leafsize;
160         root->stripesize = stripesize;
161         root->ref_cows = 0;
162         root->track_dirty = 0;
163
164         root->fs_info = fs_info;
165         root->objectid = objectid;
166         root->last_trans = 0;
167         root->highest_inode = 0;
168         root->last_inode_alloc = 0;
169
170         INIT_LIST_HEAD(&root->dirty_list);
171         memset(&root->root_key, 0, sizeof(root->root_key));
172         memset(&root->root_item, 0, sizeof(root->root_item));
173         root->root_key.objectid = objectid;
174         return 0;
175 }
176
177 static int update_cowonly_root(struct btrfs_trans_handle *trans,
178                                struct btrfs_root *root)
179 {
180         int ret;
181         u64 old_root_bytenr;
182         struct btrfs_root *tree_root = root->fs_info->tree_root;
183
184         btrfs_write_dirty_block_groups(trans, root);
185         while(1) {
186                 old_root_bytenr = btrfs_root_bytenr(&root->root_item);
187                 if (old_root_bytenr == root->node->start)
188                         break;
189                 btrfs_set_root_bytenr(&root->root_item,
190                                        root->node->start);
191                 root->root_item.level = btrfs_header_level(root->node);
192                 ret = btrfs_update_root(trans, tree_root,
193                                         &root->root_key,
194                                         &root->root_item);
195                 BUG_ON(ret);
196                 btrfs_write_dirty_block_groups(trans, root);
197         }
198         return 0;
199 }
200
201 static int commit_tree_roots(struct btrfs_trans_handle *trans,
202                              struct btrfs_fs_info *fs_info)
203 {
204         struct btrfs_root *root;
205         struct list_head *next;
206
207         while(!list_empty(&fs_info->dirty_cowonly_roots)) {
208                 next = fs_info->dirty_cowonly_roots.next;
209                 list_del_init(next);
210                 root = list_entry(next, struct btrfs_root, dirty_list);
211                 update_cowonly_root(trans, root);
212         }
213         return 0;
214 }
215
216 static int __commit_transaction(struct btrfs_trans_handle *trans,
217                                 struct btrfs_root *root)
218 {
219         u64 start;
220         u64 end;
221         struct extent_buffer *eb;
222         struct extent_io_tree *tree = &root->fs_info->extent_cache;
223         int ret;
224
225         while(1) {
226                 ret = find_first_extent_bit(tree, 0, &start, &end,
227                                             EXTENT_DIRTY);
228                 if (ret)
229                         break;
230                 while(start <= end) {
231                         eb = find_first_extent_buffer(tree, start);
232                         BUG_ON(!eb || eb->start != start);
233                         ret = write_tree_block(trans, root, eb);
234                         BUG_ON(ret);
235                         start += eb->len;
236                         clear_extent_buffer_dirty(eb);
237                         free_extent_buffer(eb);
238                 }
239         }
240         return 0;
241 }
242
243 int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
244                              struct btrfs_root *root)
245 {
246         int ret = 0;
247         struct btrfs_root *new_root = NULL;
248         struct btrfs_fs_info *fs_info = root->fs_info;
249
250         if (root->commit_root == root->node)
251                 goto commit_tree;
252
253         new_root = malloc(sizeof(*new_root));
254         if (!new_root)
255                 return -ENOMEM;
256         memcpy(new_root, root, sizeof(*new_root));
257         new_root->node = root->commit_root;
258         root->commit_root = NULL;
259
260         root->root_key.offset = trans->transid;
261         btrfs_set_root_bytenr(&root->root_item, root->node->start);
262         root->root_item.level = btrfs_header_level(root->node);
263         ret = btrfs_insert_root(trans, fs_info->tree_root,
264                                 &root->root_key, &root->root_item);
265         BUG_ON(ret);
266
267         btrfs_set_root_refs(&new_root->root_item, 0);
268         ret = btrfs_update_root(trans, root->fs_info->tree_root,
269                                 &new_root->root_key, &new_root->root_item);
270         BUG_ON(ret);
271
272         ret = commit_tree_roots(trans, fs_info);
273         BUG_ON(ret);
274         ret = __commit_transaction(trans, root);
275         BUG_ON(ret);
276         write_ctree_super(trans, root);
277         btrfs_finish_extent_commit(trans, fs_info->extent_root,
278                                    &fs_info->pinned_extents);
279         btrfs_free_transaction(root, trans);
280         fs_info->running_transaction = NULL;
281
282         trans = btrfs_start_transaction(root, 1);
283         ret = btrfs_drop_snapshot(trans, new_root);
284         BUG_ON(ret);
285         ret = btrfs_del_root(trans, fs_info->tree_root, &new_root->root_key);
286         BUG_ON(ret);
287 commit_tree:
288         ret = commit_tree_roots(trans, fs_info);
289         BUG_ON(ret);
290         ret = __commit_transaction(trans, root);
291         BUG_ON(ret);
292         write_ctree_super(trans, root);
293         btrfs_finish_extent_commit(trans, fs_info->extent_root,
294                                    &fs_info->pinned_extents);
295         btrfs_free_transaction(root, trans);
296         free_extent_buffer(root->commit_root);
297         root->commit_root = NULL;
298         fs_info->running_transaction = NULL;
299         if (new_root) {
300                 free_extent_buffer(new_root->node);
301                 free(new_root);
302         }
303         return 0;
304 }
305
306 static int find_and_setup_root(struct btrfs_root *tree_root,
307                                struct btrfs_fs_info *fs_info,
308                                u64 objectid, struct btrfs_root *root)
309 {
310         int ret;
311         u32 blocksize;
312
313         __setup_root(tree_root->nodesize, tree_root->leafsize,
314                      tree_root->sectorsize, tree_root->stripesize,
315                      root, fs_info, objectid);
316         ret = btrfs_find_last_root(tree_root, objectid,
317                                    &root->root_item, &root->root_key);
318         BUG_ON(ret);
319
320         blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
321         root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
322                                      blocksize);
323         BUG_ON(!root->node);
324         return 0;
325 }
326
327 int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
328 {
329         if (root->node)
330                 free_extent_buffer(root->node);
331         if (root->commit_root)
332                 free_extent_buffer(root->commit_root);
333
334         free(root);
335         return 0;
336 }
337
338 struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
339                                       struct btrfs_key *location)
340 {
341         struct btrfs_root *root;
342         struct btrfs_root *tree_root = fs_info->tree_root;
343         struct btrfs_path *path;
344         struct extent_buffer *l;
345         u32 blocksize;
346         int ret = 0;
347
348         root = malloc(sizeof(*root));
349         if (!root)
350                 return ERR_PTR(-ENOMEM);
351         memset(root, 0, sizeof(*root));
352         if (location->offset == (u64)-1) {
353                 ret = find_and_setup_root(tree_root, fs_info,
354                                           location->objectid, root);
355                 if (ret) {
356                         free(root);
357                         return ERR_PTR(ret);
358                 }
359                 goto insert;
360         }
361
362         __setup_root(tree_root->nodesize, tree_root->leafsize,
363                      tree_root->sectorsize, tree_root->stripesize,
364                      root, fs_info, location->objectid);
365
366         path = btrfs_alloc_path();
367         BUG_ON(!path);
368         ret = btrfs_search_slot(NULL, tree_root, location, path, 0, 0);
369         if (ret != 0) {
370                 if (ret > 0)
371                         ret = -ENOENT;
372                 goto out;
373         }
374         l = path->nodes[0];
375         read_extent_buffer(l, &root->root_item,
376                btrfs_item_ptr_offset(l, path->slots[0]),
377                sizeof(root->root_item));
378         memcpy(&root->root_key, location, sizeof(*location));
379         ret = 0;
380 out:
381         btrfs_release_path(root, path);
382         btrfs_free_path(path);
383         if (ret) {
384                 free(root);
385                 return ERR_PTR(ret);
386         }
387         blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
388         root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
389                                      blocksize);
390         BUG_ON(!root->node);
391 insert:
392         root->ref_cows = 1;
393         return root;
394 }
395
396 struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr)
397 {
398         int fp;
399
400         fp = open(filename, O_CREAT | O_RDWR, 0600);
401         if (fp < 0) {
402                 return NULL;
403         }
404         return open_ctree_fd(fp, filename, sb_bytenr);
405 }
406
407 struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr)
408 {
409         u32 sectorsize;
410         u32 nodesize;
411         u32 leafsize;
412         u32 blocksize;
413         u32 stripesize;
414         struct btrfs_root *root = malloc(sizeof(struct btrfs_root));
415         struct btrfs_root *tree_root = malloc(sizeof(struct btrfs_root));
416         struct btrfs_root *extent_root = malloc(sizeof(struct btrfs_root));
417         struct btrfs_root *chunk_root = malloc(sizeof(struct btrfs_root));
418         struct btrfs_root *dev_root = malloc(sizeof(struct btrfs_root));
419         struct btrfs_fs_info *fs_info = malloc(sizeof(*fs_info));
420         int ret;
421         struct btrfs_super_block *disk_super;
422         struct btrfs_fs_devices *fs_devices = NULL;
423         u64 total_devs;
424
425         if (sb_bytenr == 0)
426                 sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
427
428         ret = btrfs_scan_one_device(fp, path, &fs_devices,
429                                     &total_devs, sb_bytenr);
430
431         if (ret) {
432                 fprintf(stderr, "No valid Btrfs found on %s\n", path);
433                 return NULL;
434         }
435         fprintf(stderr, "found Btrfs on %s with %lu devices\n", path,
436                 (unsigned long)total_devs);
437
438         if (total_devs != 1) {
439                 ret = btrfs_scan_for_fsid(fs_devices, total_devs, 1);
440                 BUG_ON(ret);
441         }
442
443         fs_info->fp = fs_devices->lowest_bdev;
444         fs_info->running_transaction = NULL;
445         fs_info->fs_root = root;
446         fs_info->tree_root = tree_root;
447         fs_info->extent_root = extent_root;
448         fs_info->extent_ops = NULL;
449         fs_info->priv_data = NULL;
450         fs_info->chunk_root = chunk_root;
451         fs_info->dev_root = dev_root;
452         fs_info->force_system_allocs = 0;
453
454         extent_io_tree_init(&fs_info->extent_cache);
455         extent_io_tree_init(&fs_info->free_space_cache);
456         extent_io_tree_init(&fs_info->block_group_cache);
457         extent_io_tree_init(&fs_info->pinned_extents);
458         extent_io_tree_init(&fs_info->pending_del);
459         extent_io_tree_init(&fs_info->extent_ins);
460
461         cache_tree_init(&fs_info->mapping_tree.cache_tree);
462
463         mutex_init(&fs_info->fs_mutex);
464         fs_info->fs_devices = fs_devices;
465         INIT_LIST_HEAD(&fs_info->dirty_cowonly_roots);
466         INIT_LIST_HEAD(&fs_info->space_info);
467
468         __setup_root(4096, 4096, 4096, 4096, tree_root,
469                      fs_info, BTRFS_ROOT_TREE_OBJECTID);
470
471         ret = btrfs_open_devices(fs_devices, O_RDWR);
472         BUG_ON(ret);
473
474         fs_info->sb_buffer = btrfs_find_create_tree_block(tree_root, sb_bytenr,
475                                                           4096);
476         BUG_ON(!fs_info->sb_buffer);
477         fs_info->sb_buffer->fd = fs_devices->lowest_bdev;
478         fs_info->sb_buffer->dev_bytenr = sb_bytenr;
479         ret = read_extent_from_disk(fs_info->sb_buffer);
480         BUG_ON(ret);
481         btrfs_set_buffer_uptodate(fs_info->sb_buffer);
482
483         read_extent_buffer(fs_info->sb_buffer, &fs_info->super_copy, 0,
484                            sizeof(fs_info->super_copy));
485         read_extent_buffer(fs_info->sb_buffer, fs_info->fsid,
486                            (unsigned long)btrfs_super_fsid(fs_info->sb_buffer),
487                            BTRFS_FSID_SIZE);
488
489         disk_super = &fs_info->super_copy;
490         if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
491                     sizeof(disk_super->magic))) {
492                 printk("No valid btrfs found\n");
493                 BUG_ON(1);
494         }
495         nodesize = btrfs_super_nodesize(disk_super);
496         leafsize = btrfs_super_leafsize(disk_super);
497         sectorsize = btrfs_super_sectorsize(disk_super);
498         stripesize = btrfs_super_stripesize(disk_super);
499         tree_root->nodesize = nodesize;
500         tree_root->leafsize = leafsize;
501         tree_root->sectorsize = sectorsize;
502         tree_root->stripesize = stripesize;
503
504         ret = btrfs_read_super_device(tree_root, fs_info->sb_buffer);
505         BUG_ON(ret);
506         ret = btrfs_read_sys_array(tree_root);
507         BUG_ON(ret);
508         blocksize = btrfs_level_size(tree_root,
509                                      btrfs_super_chunk_root_level(disk_super));
510
511         __setup_root(nodesize, leafsize, sectorsize, stripesize,
512                      chunk_root, fs_info, BTRFS_CHUNK_TREE_OBJECTID);
513
514         chunk_root->node = read_tree_block(chunk_root,
515                                            btrfs_super_chunk_root(disk_super),
516                                            blocksize);
517
518         BUG_ON(!chunk_root->node);
519
520         ret = btrfs_read_chunk_tree(chunk_root);
521         BUG_ON(ret);
522
523         blocksize = btrfs_level_size(tree_root,
524                                      btrfs_super_root_level(disk_super));
525
526         tree_root->node = read_tree_block(tree_root,
527                                           btrfs_super_root(disk_super),
528                                           blocksize);
529         BUG_ON(!tree_root->node);
530         ret = find_and_setup_root(tree_root, fs_info,
531                                   BTRFS_EXTENT_TREE_OBJECTID, extent_root);
532         BUG_ON(ret);
533         extent_root->track_dirty = 1;
534
535         ret = find_and_setup_root(tree_root, fs_info,
536                                   BTRFS_DEV_TREE_OBJECTID, dev_root);
537         BUG_ON(ret);
538         dev_root->track_dirty = 1;
539
540         ret = find_and_setup_root(tree_root, fs_info,
541                                   BTRFS_FS_TREE_OBJECTID, root);
542         BUG_ON(ret);
543         root->ref_cows = 1;
544         fs_info->generation = btrfs_super_generation(disk_super) + 1;
545         btrfs_read_block_groups(root);
546         return root;
547 }
548
549 int write_ctree_super(struct btrfs_trans_handle *trans,
550                       struct btrfs_root *root)
551 {
552         int ret;
553         struct btrfs_root *tree_root = root->fs_info->tree_root;
554         struct btrfs_root *chunk_root = root->fs_info->chunk_root;
555         btrfs_set_super_generation(&root->fs_info->super_copy,
556                                    trans->transid);
557         btrfs_set_super_root(&root->fs_info->super_copy,
558                              tree_root->node->start);
559         btrfs_set_super_root_level(&root->fs_info->super_copy,
560                                    btrfs_header_level(tree_root->node));
561         btrfs_set_super_chunk_root(&root->fs_info->super_copy,
562                                    chunk_root->node->start);
563         btrfs_set_super_chunk_root_level(&root->fs_info->super_copy,
564                                          btrfs_header_level(chunk_root->node));
565         write_extent_buffer(root->fs_info->sb_buffer,
566                             &root->fs_info->super_copy, 0,
567                             sizeof(root->fs_info->super_copy));
568         ret = write_tree_block(trans, root, root->fs_info->sb_buffer);
569         if (ret)
570                 fprintf(stderr, "failed to write new super block err %d\n", ret);
571         return ret;
572 }
573
574 static int close_all_devices(struct btrfs_fs_info *fs_info)
575 {
576         struct list_head *list;
577         struct list_head *next;
578         struct btrfs_device *device;
579
580         return 0;
581
582         list = &fs_info->fs_devices->devices;
583         list_for_each(next, list) {
584                 device = list_entry(next, struct btrfs_device, dev_list);
585                 // close(device->fd);
586         }
587         return 0;
588 }
589
590 int close_ctree(struct btrfs_root *root)
591 {
592         int ret;
593         struct btrfs_trans_handle *trans;
594         struct btrfs_fs_info *fs_info = root->fs_info;
595
596         trans = btrfs_start_transaction(root, 1);
597         btrfs_commit_transaction(trans, root);
598         trans = btrfs_start_transaction(root, 1);
599         ret = commit_tree_roots(trans, root->fs_info);
600         BUG_ON(ret);
601         ret = __commit_transaction(trans, root);
602         BUG_ON(ret);
603         write_ctree_super(trans, root);
604         btrfs_free_transaction(root, trans);
605         btrfs_free_block_groups(root->fs_info);
606         close(root->fs_info->fp);
607         if (root->node)
608                 free_extent_buffer(root->node);
609         if (root->fs_info->extent_root->node)
610                 free_extent_buffer(root->fs_info->extent_root->node);
611         if (root->fs_info->tree_root->node)
612                 free_extent_buffer(root->fs_info->tree_root->node);
613         free_extent_buffer(root->commit_root);
614         free_extent_buffer(root->fs_info->sb_buffer);
615
616         if (root->fs_info->chunk_root->node);
617                 free_extent_buffer(root->fs_info->chunk_root->node);
618
619         if (root->fs_info->dev_root->node);
620                 free_extent_buffer(root->fs_info->dev_root->node);
621
622         close_all_devices(root->fs_info);
623         extent_io_tree_cleanup(&fs_info->extent_cache);
624         extent_io_tree_cleanup(&fs_info->free_space_cache);
625         extent_io_tree_cleanup(&fs_info->block_group_cache);
626         extent_io_tree_cleanup(&fs_info->pinned_extents);
627         extent_io_tree_cleanup(&fs_info->pending_del);
628         extent_io_tree_cleanup(&fs_info->extent_ins);
629
630         free(fs_info->tree_root);
631         free(fs_info->extent_root);
632         free(fs_info->fs_root);
633         free(fs_info->chunk_root);
634         free(fs_info->dev_root);
635         free(fs_info);
636
637         return 0;
638 }
639
640 int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
641                      struct extent_buffer *eb)
642 {
643         return clear_extent_buffer_dirty(eb);
644 }
645
646 int wait_on_tree_block_writeback(struct btrfs_root *root,
647                                  struct extent_buffer *eb)
648 {
649         return 0;
650 }
651
652 void btrfs_mark_buffer_dirty(struct extent_buffer *eb)
653 {
654         set_extent_buffer_dirty(eb);
655 }
656
657 int btrfs_buffer_uptodate(struct extent_buffer *eb)
658 {
659         return extent_buffer_uptodate(eb);
660 }
661
662 int btrfs_set_buffer_uptodate(struct extent_buffer *eb)
663 {
664         return set_extent_buffer_uptodate(eb);
665 }