disk-io.c (1a5bc167f6707542b79a55452075525620ed43f5) disk-io.c (db94535db75e67fab12ccbb7f5ee548e33fed891)
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,

--- 14 unchanged lines hidden (view full) ---

23#include <linux/swap.h>
24#include <linux/radix-tree.h>
25#include <linux/writeback.h>
26#include <linux/buffer_head.h> // for block_sync_page
27#include "ctree.h"
28#include "disk-io.h"
29#include "transaction.h"
30#include "btrfs_inode.h"
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,

--- 14 unchanged lines hidden (view full) ---

23#include <linux/swap.h>
24#include <linux/radix-tree.h>
25#include <linux/writeback.h>
26#include <linux/buffer_head.h> // for block_sync_page
27#include "ctree.h"
28#include "disk-io.h"
29#include "transaction.h"
30#include "btrfs_inode.h"
31#include "print-tree.h"
31
32#if 0
33static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
34{
35 if (extent_buffer_blocknr(buf) != btrfs_header_blocknr(buf)) {
36 printk(KERN_CRIT "buf blocknr(buf) is %llu, header is %llu\n",
37 (unsigned long long)extent_buffer_blocknr(buf),
38 (unsigned long long)btrfs_header_blocknr(buf));
39 return 1;
40 }
41 return 0;
42}
43#endif
44
45struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
32
33#if 0
34static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
35{
36 if (extent_buffer_blocknr(buf) != btrfs_header_blocknr(buf)) {
37 printk(KERN_CRIT "buf blocknr(buf) is %llu, header is %llu\n",
38 (unsigned long long)extent_buffer_blocknr(buf),
39 (unsigned long long)btrfs_header_blocknr(buf));
40 return 1;
41 }
42 return 0;
43}
44#endif
45
46struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
46 u64 blocknr)
47 u64 bytenr, u32 blocksize)
47{
48 struct inode *btree_inode = root->fs_info->btree_inode;
49 struct extent_buffer *eb;
50 eb = find_extent_buffer(&BTRFS_I(btree_inode)->extent_tree,
48{
49 struct inode *btree_inode = root->fs_info->btree_inode;
50 struct extent_buffer *eb;
51 eb = find_extent_buffer(&BTRFS_I(btree_inode)->extent_tree,
51 blocknr * root->sectorsize,
52 root->sectorsize, GFP_NOFS);
52 bytenr, blocksize, GFP_NOFS);
53 if (eb)
54 eb->alloc_addr = (unsigned long)__builtin_return_address(0);
55 return eb;
56}
57
58struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
53 if (eb)
54 eb->alloc_addr = (unsigned long)__builtin_return_address(0);
55 return eb;
56}
57
58struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
59 u64 blocknr)
59 u64 bytenr, u32 blocksize)
60{
61 struct inode *btree_inode = root->fs_info->btree_inode;
62 struct extent_buffer *eb;
60{
61 struct inode *btree_inode = root->fs_info->btree_inode;
62 struct extent_buffer *eb;
63
63 eb = alloc_extent_buffer(&BTRFS_I(btree_inode)->extent_tree,
64 eb = alloc_extent_buffer(&BTRFS_I(btree_inode)->extent_tree,
64 blocknr * root->sectorsize,
65 root->sectorsize, GFP_NOFS);
65 bytenr, blocksize, GFP_NOFS);
66 eb->alloc_addr = (unsigned long)__builtin_return_address(0);
67 return eb;
68}
69
70struct extent_map *btree_get_extent(struct inode *inode, struct page *page,
71 size_t page_offset, u64 start, u64 end,
72 int create)
73{

--- 129 unchanged lines hidden (view full) ---

203static struct address_space_operations btree_aops = {
204 .readpage = btree_readpage,
205 .writepage = btree_writepage,
206 .releasepage = btree_releasepage,
207 .invalidatepage = btree_invalidatepage,
208 .sync_page = block_sync_page,
209};
210
66 eb->alloc_addr = (unsigned long)__builtin_return_address(0);
67 return eb;
68}
69
70struct extent_map *btree_get_extent(struct inode *inode, struct page *page,
71 size_t page_offset, u64 start, u64 end,
72 int create)
73{

--- 129 unchanged lines hidden (view full) ---

203static struct address_space_operations btree_aops = {
204 .readpage = btree_readpage,
205 .writepage = btree_writepage,
206 .releasepage = btree_releasepage,
207 .invalidatepage = btree_invalidatepage,
208 .sync_page = block_sync_page,
209};
210
211int readahead_tree_block(struct btrfs_root *root, u64 blocknr)
211int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize)
212{
213 struct extent_buffer *buf = NULL;
214 struct inode *btree_inode = root->fs_info->btree_inode;
215 int ret = 0;
216
212{
213 struct extent_buffer *buf = NULL;
214 struct inode *btree_inode = root->fs_info->btree_inode;
215 int ret = 0;
216
217 buf = btrfs_find_create_tree_block(root, blocknr);
217 buf = btrfs_find_create_tree_block(root, bytenr, blocksize);
218 if (!buf)
219 return 0;
220 read_extent_buffer_pages(&BTRFS_I(btree_inode)->extent_tree,
221 buf, 0);
222 free_extent_buffer(buf);
223 return ret;
224}
225
218 if (!buf)
219 return 0;
220 read_extent_buffer_pages(&BTRFS_I(btree_inode)->extent_tree,
221 buf, 0);
222 free_extent_buffer(buf);
223 return ret;
224}
225
226struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 blocknr)
226struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
227 u32 blocksize)
227{
228 struct extent_buffer *buf = NULL;
229 struct inode *btree_inode = root->fs_info->btree_inode;
230
228{
229 struct extent_buffer *buf = NULL;
230 struct inode *btree_inode = root->fs_info->btree_inode;
231
231 buf = btrfs_find_create_tree_block(root, blocknr);
232 buf = btrfs_find_create_tree_block(root, bytenr, blocksize);
232 if (!buf)
233 return NULL;
234 read_extent_buffer_pages(&BTRFS_I(btree_inode)->extent_tree,
235 buf, 1);
236 buf->alloc_addr = (unsigned long)__builtin_return_address(0);
237 return buf;
238}
239

--- 16 unchanged lines hidden (view full) ---

256
257int set_tree_block_dirty(struct btrfs_root *root, struct extent_buffer *buf)
258{
259 struct inode *btree_inode = root->fs_info->btree_inode;
260 set_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf);
261 return 0;
262}
263
233 if (!buf)
234 return NULL;
235 read_extent_buffer_pages(&BTRFS_I(btree_inode)->extent_tree,
236 buf, 1);
237 buf->alloc_addr = (unsigned long)__builtin_return_address(0);
238 return buf;
239}
240

--- 16 unchanged lines hidden (view full) ---

257
258int set_tree_block_dirty(struct btrfs_root *root, struct extent_buffer *buf)
259{
260 struct inode *btree_inode = root->fs_info->btree_inode;
261 set_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf);
262 return 0;
263}
264
264static int __setup_root(int blocksize,
265static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
265 struct btrfs_root *root,
266 struct btrfs_fs_info *fs_info,
267 u64 objectid)
268{
269 root->node = NULL;
270 root->inode = NULL;
271 root->commit_root = NULL;
266 struct btrfs_root *root,
267 struct btrfs_fs_info *fs_info,
268 u64 objectid)
269{
270 root->node = NULL;
271 root->inode = NULL;
272 root->commit_root = NULL;
272 root->sectorsize = blocksize;
273 root->nodesize = blocksize;
274 root->leafsize = blocksize;
273 root->sectorsize = sectorsize;
274 root->nodesize = nodesize;
275 root->leafsize = leafsize;
275 root->ref_cows = 0;
276 root->fs_info = fs_info;
277 root->objectid = objectid;
278 root->last_trans = 0;
279 root->highest_inode = 0;
280 root->last_inode_alloc = 0;
281 root->name = NULL;
282 memset(&root->root_key, 0, sizeof(root->root_key));
283 memset(&root->root_item, 0, sizeof(root->root_item));
284 memset(&root->defrag_progress, 0, sizeof(root->defrag_progress));
285 memset(&root->root_kobj, 0, sizeof(root->root_kobj));
286 init_completion(&root->kobj_unregister);
287 init_rwsem(&root->snap_sem);
288 root->defrag_running = 0;
289 root->defrag_level = 0;
290 root->root_key.objectid = objectid;
291 return 0;
292}
293
276 root->ref_cows = 0;
277 root->fs_info = fs_info;
278 root->objectid = objectid;
279 root->last_trans = 0;
280 root->highest_inode = 0;
281 root->last_inode_alloc = 0;
282 root->name = NULL;
283 memset(&root->root_key, 0, sizeof(root->root_key));
284 memset(&root->root_item, 0, sizeof(root->root_item));
285 memset(&root->defrag_progress, 0, sizeof(root->defrag_progress));
286 memset(&root->root_kobj, 0, sizeof(root->root_kobj));
287 init_completion(&root->kobj_unregister);
288 init_rwsem(&root->snap_sem);
289 root->defrag_running = 0;
290 root->defrag_level = 0;
291 root->root_key.objectid = objectid;
292 return 0;
293}
294
294static int find_and_setup_root(int blocksize,
295 struct btrfs_root *tree_root,
295static int find_and_setup_root(struct btrfs_root *tree_root,
296 struct btrfs_fs_info *fs_info,
297 u64 objectid,
298 struct btrfs_root *root)
299{
300 int ret;
296 struct btrfs_fs_info *fs_info,
297 u64 objectid,
298 struct btrfs_root *root)
299{
300 int ret;
301 u32 blocksize;
301
302
302 __setup_root(blocksize, root, fs_info, objectid);
303 __setup_root(tree_root->nodesize, tree_root->leafsize,
304 tree_root->sectorsize, root, fs_info, objectid);
303 ret = btrfs_find_last_root(tree_root, objectid,
304 &root->root_item, &root->root_key);
305 BUG_ON(ret);
306
305 ret = btrfs_find_last_root(tree_root, objectid,
306 &root->root_item, &root->root_key);
307 BUG_ON(ret);
308
307 root->node = read_tree_block(root,
308 btrfs_root_blocknr(&root->root_item));
309 blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
310 root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
311 blocksize);
309 BUG_ON(!root->node);
310 return 0;
311}
312
313struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_fs_info *fs_info,
314 struct btrfs_key *location)
315{
316 struct btrfs_root *root;
317 struct btrfs_root *tree_root = fs_info->tree_root;
318 struct btrfs_path *path;
319 struct extent_buffer *l;
320 u64 highest_inode;
312 BUG_ON(!root->node);
313 return 0;
314}
315
316struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_fs_info *fs_info,
317 struct btrfs_key *location)
318{
319 struct btrfs_root *root;
320 struct btrfs_root *tree_root = fs_info->tree_root;
321 struct btrfs_path *path;
322 struct extent_buffer *l;
323 u64 highest_inode;
324 u32 blocksize;
321 int ret = 0;
322
323 root = kzalloc(sizeof(*root), GFP_NOFS);
324 if (!root)
325 return ERR_PTR(-ENOMEM);
326 if (location->offset == (u64)-1) {
325 int ret = 0;
326
327 root = kzalloc(sizeof(*root), GFP_NOFS);
328 if (!root)
329 return ERR_PTR(-ENOMEM);
330 if (location->offset == (u64)-1) {
327 ret = find_and_setup_root(fs_info->sb->s_blocksize,
328 fs_info->tree_root, fs_info,
331 ret = find_and_setup_root(tree_root, fs_info,
329 location->objectid, root);
330 if (ret) {
331 kfree(root);
332 return ERR_PTR(ret);
333 }
334 goto insert;
335 }
336
332 location->objectid, root);
333 if (ret) {
334 kfree(root);
335 return ERR_PTR(ret);
336 }
337 goto insert;
338 }
339
337 __setup_root(fs_info->sb->s_blocksize, root, fs_info,
340 __setup_root(tree_root->nodesize, tree_root->leafsize,
341 tree_root->sectorsize, root, fs_info,
338 location->objectid);
339
340 path = btrfs_alloc_path();
341 BUG_ON(!path);
342 ret = btrfs_search_slot(NULL, tree_root, location, path, 0, 0);
343 if (ret != 0) {
344 if (ret > 0)
345 ret = -ENOENT;

--- 6 unchanged lines hidden (view full) ---

352 ret = 0;
353out:
354 btrfs_release_path(root, path);
355 btrfs_free_path(path);
356 if (ret) {
357 kfree(root);
358 return ERR_PTR(ret);
359 }
342 location->objectid);
343
344 path = btrfs_alloc_path();
345 BUG_ON(!path);
346 ret = btrfs_search_slot(NULL, tree_root, location, path, 0, 0);
347 if (ret != 0) {
348 if (ret > 0)
349 ret = -ENOENT;

--- 6 unchanged lines hidden (view full) ---

356 ret = 0;
357out:
358 btrfs_release_path(root, path);
359 btrfs_free_path(path);
360 if (ret) {
361 kfree(root);
362 return ERR_PTR(ret);
363 }
360 root->node = read_tree_block(root,
361 btrfs_root_blocknr(&root->root_item));
364 blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
365 root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
366 blocksize);
362 BUG_ON(!root->node);
363insert:
364 root->ref_cows = 1;
365 ret = btrfs_find_highest_inode(root, &highest_inode);
366 if (ret == 0) {
367 root->highest_inode = highest_inode;
368 root->last_inode_alloc = highest_inode;
369 }

--- 43 unchanged lines hidden (view full) ---

413 root->root_key.objectid, root);
414 BUG_ON(ret);
415
416 return root;
417}
418
419struct btrfs_root *open_ctree(struct super_block *sb)
420{
367 BUG_ON(!root->node);
368insert:
369 root->ref_cows = 1;
370 ret = btrfs_find_highest_inode(root, &highest_inode);
371 if (ret == 0) {
372 root->highest_inode = highest_inode;
373 root->last_inode_alloc = highest_inode;
374 }

--- 43 unchanged lines hidden (view full) ---

418 root->root_key.objectid, root);
419 BUG_ON(ret);
420
421 return root;
422}
423
424struct btrfs_root *open_ctree(struct super_block *sb)
425{
426 u32 sectorsize;
427 u32 nodesize;
428 u32 leafsize;
429 u32 blocksize;
421 struct btrfs_root *extent_root = kmalloc(sizeof(struct btrfs_root),
422 GFP_NOFS);
423 struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root),
424 GFP_NOFS);
425 struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info),
426 GFP_NOFS);
427 int ret;
428 int err = -EIO;

--- 40 unchanged lines hidden (view full) ---

469 memset(&BTRFS_I(fs_info->btree_inode)->location, 0,
470 sizeof(struct btrfs_key));
471 insert_inode_hash(fs_info->btree_inode);
472 mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS);
473
474 mutex_init(&fs_info->trans_mutex);
475 mutex_init(&fs_info->fs_mutex);
476
430 struct btrfs_root *extent_root = kmalloc(sizeof(struct btrfs_root),
431 GFP_NOFS);
432 struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root),
433 GFP_NOFS);
434 struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info),
435 GFP_NOFS);
436 int ret;
437 int err = -EIO;

--- 40 unchanged lines hidden (view full) ---

478 memset(&BTRFS_I(fs_info->btree_inode)->location, 0,
479 sizeof(struct btrfs_key));
480 insert_inode_hash(fs_info->btree_inode);
481 mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS);
482
483 mutex_init(&fs_info->trans_mutex);
484 mutex_init(&fs_info->fs_mutex);
485
477 __setup_root(sb->s_blocksize, tree_root,
486 __setup_root(512, 512, 512, tree_root,
478 fs_info, BTRFS_ROOT_TREE_OBJECTID);
479
480 fs_info->sb_buffer = read_tree_block(tree_root,
487 fs_info, BTRFS_ROOT_TREE_OBJECTID);
488
489 fs_info->sb_buffer = read_tree_block(tree_root,
481 BTRFS_SUPER_INFO_OFFSET /
482 sb->s_blocksize);
490 BTRFS_SUPER_INFO_OFFSET,
491 512);
483
484 if (!fs_info->sb_buffer)
485 goto fail_iput;
486
487 read_extent_buffer(fs_info->sb_buffer, &fs_info->super_copy, 0,
488 sizeof(fs_info->super_copy));
489
490 read_extent_buffer(fs_info->sb_buffer, fs_info->fsid,
491 (unsigned long)btrfs_super_fsid(fs_info->sb_buffer),
492 BTRFS_FSID_SIZE);
493 disk_super = &fs_info->super_copy;
494 if (!btrfs_super_root(disk_super))
495 goto fail_sb_buffer;
496
492
493 if (!fs_info->sb_buffer)
494 goto fail_iput;
495
496 read_extent_buffer(fs_info->sb_buffer, &fs_info->super_copy, 0,
497 sizeof(fs_info->super_copy));
498
499 read_extent_buffer(fs_info->sb_buffer, fs_info->fsid,
500 (unsigned long)btrfs_super_fsid(fs_info->sb_buffer),
501 BTRFS_FSID_SIZE);
502 disk_super = &fs_info->super_copy;
503 if (!btrfs_super_root(disk_super))
504 goto fail_sb_buffer;
505
506 nodesize = btrfs_super_nodesize(disk_super);
507 leafsize = btrfs_super_leafsize(disk_super);
508 sectorsize = btrfs_super_sectorsize(disk_super);
509 tree_root->nodesize = nodesize;
510 tree_root->leafsize = leafsize;
511 tree_root->sectorsize = sectorsize;
512
497 i_size_write(fs_info->btree_inode,
513 i_size_write(fs_info->btree_inode,
498 btrfs_super_total_blocks(disk_super) <<
499 fs_info->btree_inode->i_blkbits);
514 btrfs_super_total_bytes(disk_super));
500
501
502 if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
503 sizeof(disk_super->magic))) {
504 printk("btrfs: valid FS not found on %s\n", sb->s_id);
505 goto fail_sb_buffer;
506 }
515
516
517 if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
518 sizeof(disk_super->magic))) {
519 printk("btrfs: valid FS not found on %s\n", sb->s_id);
520 goto fail_sb_buffer;
521 }
522 blocksize = btrfs_level_size(tree_root,
523 btrfs_super_root_level(disk_super));
507 tree_root->node = read_tree_block(tree_root,
524 tree_root->node = read_tree_block(tree_root,
508 btrfs_super_root(disk_super));
525 btrfs_super_root(disk_super),
526 blocksize);
509 if (!tree_root->node)
510 goto fail_sb_buffer;
511
527 if (!tree_root->node)
528 goto fail_sb_buffer;
529
530#if 0
531 btrfs_print_leaf(tree_root, tree_root->node);
532 err = -EIO;
533 goto fail_tree_root;
534#endif
512 mutex_lock(&fs_info->fs_mutex);
535 mutex_lock(&fs_info->fs_mutex);
513 ret = find_and_setup_root(sb->s_blocksize, tree_root, fs_info,
536
537 ret = find_and_setup_root(tree_root, fs_info,
514 BTRFS_EXTENT_TREE_OBJECTID, extent_root);
515 if (ret) {
516 mutex_unlock(&fs_info->fs_mutex);
517 goto fail_tree_root;
518 }
519
520 btrfs_read_block_groups(extent_root);
521

--- 84 unchanged lines hidden (view full) ---

606
607 if (fs_info->extent_root->node)
608 free_extent_buffer(fs_info->extent_root->node);
609
610 if (fs_info->tree_root->node)
611 free_extent_buffer(fs_info->tree_root->node);
612
613 free_extent_buffer(fs_info->sb_buffer);
538 BTRFS_EXTENT_TREE_OBJECTID, extent_root);
539 if (ret) {
540 mutex_unlock(&fs_info->fs_mutex);
541 goto fail_tree_root;
542 }
543
544 btrfs_read_block_groups(extent_root);
545

--- 84 unchanged lines hidden (view full) ---

630
631 if (fs_info->extent_root->node)
632 free_extent_buffer(fs_info->extent_root->node);
633
634 if (fs_info->tree_root->node)
635 free_extent_buffer(fs_info->tree_root->node);
636
637 free_extent_buffer(fs_info->sb_buffer);
614 truncate_inode_pages(fs_info->btree_inode->i_mapping, 0);
615 iput(fs_info->btree_inode);
616
617 btrfs_free_block_groups(root->fs_info);
618 del_fs_roots(fs_info);
638
639 btrfs_free_block_groups(root->fs_info);
640 del_fs_roots(fs_info);
641 truncate_inode_pages(fs_info->btree_inode->i_mapping, 0);
642 iput(fs_info->btree_inode);
619 kfree(fs_info->extent_root);
620 kfree(fs_info->tree_root);
621 return 0;
622}
623
624int btrfs_buffer_uptodate(struct extent_buffer *buf)
625{
626 struct inode *btree_inode = buf->first_page->mapping->host;

--- 10 unchanged lines hidden (view full) ---

637void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
638{
639 struct btrfs_root *root = BTRFS_I(buf->first_page->mapping->host)->root;
640 u64 transid = btrfs_header_generation(buf);
641 struct inode *btree_inode = root->fs_info->btree_inode;
642
643 if (transid != root->fs_info->generation) {
644 printk(KERN_CRIT "transid mismatch buffer %llu, found %Lu running %Lu\n",
643 kfree(fs_info->extent_root);
644 kfree(fs_info->tree_root);
645 return 0;
646}
647
648int btrfs_buffer_uptodate(struct extent_buffer *buf)
649{
650 struct inode *btree_inode = buf->first_page->mapping->host;

--- 10 unchanged lines hidden (view full) ---

661void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
662{
663 struct btrfs_root *root = BTRFS_I(buf->first_page->mapping->host)->root;
664 u64 transid = btrfs_header_generation(buf);
665 struct inode *btree_inode = root->fs_info->btree_inode;
666
667 if (transid != root->fs_info->generation) {
668 printk(KERN_CRIT "transid mismatch buffer %llu, found %Lu running %Lu\n",
645 (unsigned long long)extent_buffer_blocknr(buf),
669 (unsigned long long)buf->start,
646 transid, root->fs_info->generation);
647 WARN_ON(1);
648 }
649 set_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf);
650}
651
652void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
653{
654 balance_dirty_pages_ratelimited_nr(
655 root->fs_info->btree_inode->i_mapping, nr);
656}
670 transid, root->fs_info->generation);
671 WARN_ON(1);
672 }
673 set_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf);
674}
675
676void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
677{
678 balance_dirty_pages_ratelimited_nr(
679 root->fs_info->btree_inode->i_mapping, nr);
680}