extent-tree.c (8c2a3ca20f6233677ac3222c6506174010eb414f) | extent-tree.c (f248679e86fead40cc78e724c7181d6bec1a2046) |
---|---|
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, --- 4331 unchanged lines hidden (view full) --- 4340 unsigned nr_extents = 0; 4341 int extra_reserve = 0; 4342 int flush = 1; 4343 int ret; 4344 4345 /* Need to be holding the i_mutex here if we aren't free space cache */ 4346 if (btrfs_is_free_space_inode(root, inode)) 4347 flush = 0; | 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, --- 4331 unchanged lines hidden (view full) --- 4340 unsigned nr_extents = 0; 4341 int extra_reserve = 0; 4342 int flush = 1; 4343 int ret; 4344 4345 /* Need to be holding the i_mutex here if we aren't free space cache */ 4346 if (btrfs_is_free_space_inode(root, inode)) 4347 flush = 0; |
4348 else 4349 WARN_ON(!mutex_is_locked(&inode->i_mutex)); | |
4350 4351 if (flush && btrfs_transaction_in_commit(root->fs_info)) 4352 schedule_timeout(1); 4353 | 4348 4349 if (flush && btrfs_transaction_in_commit(root->fs_info)) 4350 schedule_timeout(1); 4351 |
4352 mutex_lock(&BTRFS_I(inode)->delalloc_mutex); |
|
4354 num_bytes = ALIGN(num_bytes, root->sectorsize); 4355 4356 spin_lock(&BTRFS_I(inode)->lock); 4357 BTRFS_I(inode)->outstanding_extents++; 4358 4359 if (BTRFS_I(inode)->outstanding_extents > 4360 BTRFS_I(inode)->reserved_extents) 4361 nr_extents = BTRFS_I(inode)->outstanding_extents - --- 38 unchanged lines hidden (view full) --- 4400 4401 if (to_free) { 4402 btrfs_block_rsv_release(root, block_rsv, to_free); 4403 trace_btrfs_space_reservation(root->fs_info, 4404 "delalloc", 4405 btrfs_ino(inode), 4406 to_free, 0); 4407 } | 4353 num_bytes = ALIGN(num_bytes, root->sectorsize); 4354 4355 spin_lock(&BTRFS_I(inode)->lock); 4356 BTRFS_I(inode)->outstanding_extents++; 4357 4358 if (BTRFS_I(inode)->outstanding_extents > 4359 BTRFS_I(inode)->reserved_extents) 4360 nr_extents = BTRFS_I(inode)->outstanding_extents - --- 38 unchanged lines hidden (view full) --- 4399 4400 if (to_free) { 4401 btrfs_block_rsv_release(root, block_rsv, to_free); 4402 trace_btrfs_space_reservation(root->fs_info, 4403 "delalloc", 4404 btrfs_ino(inode), 4405 to_free, 0); 4406 } |
4407 mutex_unlock(&BTRFS_I(inode)->delalloc_mutex); |
|
4408 return ret; 4409 } 4410 4411 spin_lock(&BTRFS_I(inode)->lock); 4412 if (extra_reserve) { 4413 BTRFS_I(inode)->delalloc_meta_reserved = 1; 4414 nr_extents--; 4415 } 4416 BTRFS_I(inode)->reserved_extents += nr_extents; 4417 spin_unlock(&BTRFS_I(inode)->lock); | 4408 return ret; 4409 } 4410 4411 spin_lock(&BTRFS_I(inode)->lock); 4412 if (extra_reserve) { 4413 BTRFS_I(inode)->delalloc_meta_reserved = 1; 4414 nr_extents--; 4415 } 4416 BTRFS_I(inode)->reserved_extents += nr_extents; 4417 spin_unlock(&BTRFS_I(inode)->lock); |
4418 mutex_unlock(&BTRFS_I(inode)->delalloc_mutex); |
|
4418 4419 if (to_reserve) 4420 trace_btrfs_space_reservation(root->fs_info,"delalloc", 4421 btrfs_ino(inode), to_reserve, 1); 4422 block_rsv_add_bytes(block_rsv, to_reserve, 1); 4423 4424 return 0; 4425} --- 3493 unchanged lines hidden --- | 4419 4420 if (to_reserve) 4421 trace_btrfs_space_reservation(root->fs_info,"delalloc", 4422 btrfs_ino(inode), to_reserve, 1); 4423 block_rsv_add_bytes(block_rsv, to_reserve, 1); 4424 4425 return 0; 4426} --- 3493 unchanged lines hidden --- |