aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-02-07 17:06:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-07 17:06:18 -0500
commitcb5520f02c010e3cb974b9ac06f30aafa2eebc38 (patch)
tree8342407cebb6420f04f46694b8d812552a14cb49 /fs/btrfs/volumes.c
parenteee4da2cef8e2dc2b15066e9ebb5b2ff63396eb3 (diff)
parent3a90983dbdcb2f4f48c0d771d8e5b4d88f27fae6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (33 commits) Btrfs: Fix page count calculation btrfs: Drop __exit attribute on btrfs_exit_compress btrfs: cleanup error handling in btrfs_unlink_inode() Btrfs: exclude super blocks when we read in block groups Btrfs: make sure search_bitmap finds something in remove_from_bitmap btrfs: fix return value check of btrfs_start_transaction() btrfs: checking NULL or not in some functions Btrfs: avoid uninit variable warnings in ordered-data.c Btrfs: catch errors from btrfs_sync_log Btrfs: make shrink_delalloc a little friendlier Btrfs: handle no memory properly in prepare_pages Btrfs: do error checking in btrfs_del_csums Btrfs: use the global block reserve if we cannot reserve space Btrfs: do not release more reserved bytes to the global_block_rsv than we need Btrfs: fix check_path_shared so it returns the right value btrfs: check return value of btrfs_start_ioctl_transaction() properly btrfs: fix return value check of btrfs_join_transaction() fs/btrfs/inode.c: Add missing IS_ERR test btrfs: fix missing break in switch phrase btrfs: fix several uncheck memory allocations ...
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d158530233b7..2636a051e4b2 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1213,6 +1213,10 @@ static int btrfs_rm_dev_item(struct btrfs_root *root,
1213 return -ENOMEM; 1213 return -ENOMEM;
1214 1214
1215 trans = btrfs_start_transaction(root, 0); 1215 trans = btrfs_start_transaction(root, 0);
1216 if (IS_ERR(trans)) {
1217 btrfs_free_path(path);
1218 return PTR_ERR(trans);
1219 }
1216 key.objectid = BTRFS_DEV_ITEMS_OBJECTID; 1220 key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
1217 key.type = BTRFS_DEV_ITEM_KEY; 1221 key.type = BTRFS_DEV_ITEM_KEY;
1218 key.offset = device->devid; 1222 key.offset = device->devid;
@@ -1606,6 +1610,12 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1606 } 1610 }
1607 1611
1608 trans = btrfs_start_transaction(root, 0); 1612 trans = btrfs_start_transaction(root, 0);
1613 if (IS_ERR(trans)) {
1614 kfree(device);
1615 ret = PTR_ERR(trans);
1616 goto error;
1617 }
1618
1609 lock_chunks(root); 1619 lock_chunks(root);
1610 1620
1611 device->writeable = 1; 1621 device->writeable = 1;
@@ -1873,7 +1883,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root,
1873 return ret; 1883 return ret;
1874 1884
1875 trans = btrfs_start_transaction(root, 0); 1885 trans = btrfs_start_transaction(root, 0);
1876 BUG_ON(!trans); 1886 BUG_ON(IS_ERR(trans));
1877 1887
1878 lock_chunks(root); 1888 lock_chunks(root);
1879 1889
@@ -2047,7 +2057,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
2047 BUG_ON(ret); 2057 BUG_ON(ret);
2048 2058
2049 trans = btrfs_start_transaction(dev_root, 0); 2059 trans = btrfs_start_transaction(dev_root, 0);
2050 BUG_ON(!trans); 2060 BUG_ON(IS_ERR(trans));
2051 2061
2052 ret = btrfs_grow_device(trans, device, old_size); 2062 ret = btrfs_grow_device(trans, device, old_size);
2053 BUG_ON(ret); 2063 BUG_ON(ret);
@@ -2213,6 +2223,11 @@ again:
2213 2223
2214 /* Shrinking succeeded, else we would be at "done". */ 2224 /* Shrinking succeeded, else we would be at "done". */
2215 trans = btrfs_start_transaction(root, 0); 2225 trans = btrfs_start_transaction(root, 0);
2226 if (IS_ERR(trans)) {
2227 ret = PTR_ERR(trans);
2228 goto done;
2229 }
2230
2216 lock_chunks(root); 2231 lock_chunks(root);
2217 2232
2218 device->disk_total_bytes = new_size; 2233 device->disk_total_bytes = new_size;