Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: use join_transaction in btrfs_evict_inode()
Btrfs - use %pU to print fsid
Btrfs: fix extent state leak on failed nodatasum reads
btrfs: fix unlocked access of delalloc_inodes
Btrfs: avoid stack bloat in btrfs_ioctl_fs_info()
btrfs: remove 64bit alignment padding to allow extent_buffer to fit into one fewer cacheline
Btrfs: clear current->journal_info on async transaction commit
Btrfs: make sure to recheck for bitmaps in clusters
btrfs: remove unneeded includes from scrub.c
btrfs: reinitialize scrub workers
btrfs: scrub: errors in tree enumeration
Btrfs: don't map extent buffer if path->skip_locking is set
Btrfs: unlock the trans lock properly
Btrfs: don't map extent buffer if path->skip_locking is set
Btrfs: fix duplicate checking logic
Btrfs: fix the allocator loop logic
Btrfs: fix bitmap regression
Btrfs: don't commit the transaction if we dont have enough pinned bytes
Btrfs: noinline the cluster searching functions
Btrfs: cache bitmaps when searching for a cluster

+233 -113
+7 -3
fs/btrfs/ctree.c
··· 1228 1228 u32 nr; 1229 1229 u32 blocksize; 1230 1230 u32 nscan = 0; 1231 + bool map = true; 1231 1232 1232 1233 if (level != 1) 1233 1234 return; ··· 1250 1249 1251 1250 nritems = btrfs_header_nritems(node); 1252 1251 nr = slot; 1252 + if (node->map_token || path->skip_locking) 1253 + map = false; 1254 + 1253 1255 while (1) { 1254 - if (!node->map_token) { 1256 + if (map && !node->map_token) { 1255 1257 unsigned long offset = btrfs_node_key_ptr_offset(nr); 1256 1258 map_private_extent_buffer(node, offset, 1257 1259 sizeof(struct btrfs_key_ptr), ··· 1281 1277 if ((search <= target && target - search <= 65536) || 1282 1278 (search > target && search - target <= 65536)) { 1283 1279 gen = btrfs_node_ptr_generation(node, nr); 1284 - if (node->map_token) { 1280 + if (map && node->map_token) { 1285 1281 unmap_extent_buffer(node, node->map_token, 1286 1282 KM_USER1); 1287 1283 node->map_token = NULL; ··· 1293 1289 if ((nread > 65536 || nscan > 32)) 1294 1290 break; 1295 1291 } 1296 - if (node->map_token) { 1292 + if (map && node->map_token) { 1297 1293 unmap_extent_buffer(node, node->map_token, KM_USER1); 1298 1294 node->map_token = NULL; 1299 1295 }
+1 -4
fs/btrfs/disk-io.c
··· 1668 1668 init_waitqueue_head(&fs_info->scrub_pause_wait); 1669 1669 init_rwsem(&fs_info->scrub_super_lock); 1670 1670 fs_info->scrub_workers_refcnt = 0; 1671 - btrfs_init_workers(&fs_info->scrub_workers, "scrub", 1672 - fs_info->thread_pool_size, &fs_info->generic_worker); 1673 1671 1674 1672 sb->s_blocksize = 4096; 1675 1673 sb->s_blocksize_bits = blksize_bits(4096); ··· 2909 2911 2910 2912 INIT_LIST_HEAD(&splice); 2911 2913 2912 - list_splice_init(&root->fs_info->delalloc_inodes, &splice); 2913 - 2914 2914 spin_lock(&root->fs_info->delalloc_lock); 2915 + list_splice_init(&root->fs_info->delalloc_inodes, &splice); 2915 2916 2916 2917 while (!list_empty(&splice)) { 2917 2918 btrfs_inode = list_entry(splice.next, struct btrfs_inode,
+32 -23
fs/btrfs/extent-tree.c
··· 3089 3089 } 3090 3090 goto again; 3091 3091 } 3092 + 3093 + /* 3094 + * If we have less pinned bytes than we want to allocate then 3095 + * don't bother committing the transaction, it won't help us. 3096 + */ 3097 + if (data_sinfo->bytes_pinned < bytes) 3098 + committed = 1; 3092 3099 spin_unlock(&data_sinfo->lock); 3093 3100 3094 3101 /* commit the current transaction and try again */ ··· 5218 5211 * LOOP_NO_EMPTY_SIZE, set empty_size and empty_cluster to 0 and try 5219 5212 * again 5220 5213 */ 5221 - if (!ins->objectid && loop < LOOP_NO_EMPTY_SIZE && 5222 - (found_uncached_bg || empty_size || empty_cluster || 5223 - allowed_chunk_alloc)) { 5214 + if (!ins->objectid && loop < LOOP_NO_EMPTY_SIZE) { 5224 5215 index = 0; 5225 5216 if (loop == LOOP_FIND_IDEAL && found_uncached_bg) { 5226 5217 found_uncached_bg = false; ··· 5258 5253 goto search; 5259 5254 } 5260 5255 5261 - if (loop < LOOP_CACHING_WAIT) { 5262 - loop++; 5263 - goto search; 5264 - } 5256 + loop++; 5265 5257 5266 5258 if (loop == LOOP_ALLOC_CHUNK) { 5259 + if (allowed_chunk_alloc) { 5260 + ret = do_chunk_alloc(trans, root, num_bytes + 5261 + 2 * 1024 * 1024, data, 5262 + CHUNK_ALLOC_LIMITED); 5263 + allowed_chunk_alloc = 0; 5264 + if (ret == 1) 5265 + done_chunk_alloc = 1; 5266 + } else if (!done_chunk_alloc && 5267 + space_info->force_alloc == 5268 + CHUNK_ALLOC_NO_FORCE) { 5269 + space_info->force_alloc = CHUNK_ALLOC_LIMITED; 5270 + } 5271 + 5272 + /* 5273 + * We didn't allocate a chunk, go ahead and drop the 5274 + * empty size and loop again. 5275 + */ 5276 + if (!done_chunk_alloc) 5277 + loop = LOOP_NO_EMPTY_SIZE; 5278 + } 5279 + 5280 + if (loop == LOOP_NO_EMPTY_SIZE) { 5267 5281 empty_size = 0; 5268 5282 empty_cluster = 0; 5269 5283 } 5270 5284 5271 - if (allowed_chunk_alloc) { 5272 - ret = do_chunk_alloc(trans, root, num_bytes + 5273 - 2 * 1024 * 1024, data, 5274 - CHUNK_ALLOC_LIMITED); 5275 - allowed_chunk_alloc = 0; 5276 - done_chunk_alloc = 1; 5277 - } else if (!done_chunk_alloc && 5278 - space_info->force_alloc == CHUNK_ALLOC_NO_FORCE) { 5279 - space_info->force_alloc = CHUNK_ALLOC_LIMITED; 5280 - } 5281 - 5282 - if (loop < LOOP_NO_EMPTY_SIZE) { 5283 - loop++; 5284 - goto search; 5285 - } 5286 - ret = -ENOSPC; 5285 + goto search; 5287 5286 } else if (!ins->objectid) { 5288 5287 ret = -ENOSPC; 5289 5288 } else if (ins->objectid) {
+1 -1
fs/btrfs/extent_io.h
··· 126 126 unsigned long map_len; 127 127 struct page *first_page; 128 128 unsigned long bflags; 129 - atomic_t refs; 130 129 struct list_head leak_list; 131 130 struct rcu_head rcu_head; 131 + atomic_t refs; 132 132 133 133 /* the spinlock is used to protect most operations */ 134 134 spinlock_t lock;
+130 -33
fs/btrfs/free-space-cache.c
··· 250 250 pgoff_t index = 0; 251 251 unsigned long first_page_offset; 252 252 int num_checksums; 253 - int ret = 0, ret2; 253 + int ret = 0; 254 254 255 255 INIT_LIST_HEAD(&bitmaps); 256 256 ··· 421 421 goto free_cache; 422 422 } 423 423 spin_lock(&ctl->tree_lock); 424 - ret2 = link_free_space(ctl, e); 424 + ret = link_free_space(ctl, e); 425 425 ctl->total_bitmaps++; 426 426 ctl->op->recalc_thresholds(ctl); 427 427 spin_unlock(&ctl->tree_lock); 428 - list_add_tail(&e->list, &bitmaps); 429 428 if (ret) { 430 429 printk(KERN_ERR "Duplicate entries in " 431 430 "free space cache, dumping\n"); ··· 433 434 page_cache_release(page); 434 435 goto free_cache; 435 436 } 437 + list_add_tail(&e->list, &bitmaps); 436 438 } 437 439 438 440 num_entries--; ··· 1417 1417 return 0; 1418 1418 } 1419 1419 1420 + static u64 add_bytes_to_bitmap(struct btrfs_free_space_ctl *ctl, 1421 + struct btrfs_free_space *info, u64 offset, 1422 + u64 bytes) 1423 + { 1424 + u64 bytes_to_set = 0; 1425 + u64 end; 1426 + 1427 + end = info->offset + (u64)(BITS_PER_BITMAP * ctl->unit); 1428 + 1429 + bytes_to_set = min(end - offset, bytes); 1430 + 1431 + bitmap_set_bits(ctl, info, offset, bytes_to_set); 1432 + 1433 + return bytes_to_set; 1434 + 1435 + } 1436 + 1420 1437 static bool use_bitmap(struct btrfs_free_space_ctl *ctl, 1421 1438 struct btrfs_free_space *info) 1422 1439 { ··· 1470 1453 return true; 1471 1454 } 1472 1455 1456 + static struct btrfs_free_space_op free_space_op = { 1457 + .recalc_thresholds = recalculate_thresholds, 1458 + .use_bitmap = use_bitmap, 1459 + }; 1460 + 1473 1461 static int insert_into_bitmap(struct btrfs_free_space_ctl *ctl, 1474 1462 struct btrfs_free_space *info) 1475 1463 { 1476 1464 struct btrfs_free_space *bitmap_info; 1465 + struct btrfs_block_group_cache *block_group = NULL; 1477 1466 int added = 0; 1478 - u64 bytes, offset, end; 1467 + u64 bytes, offset, bytes_added; 1479 1468 int ret; 1480 1469 1481 1470 bytes = info->bytes; ··· 1490 1467 if (!ctl->op->use_bitmap(ctl, info)) 1491 1468 return 0; 1492 1469 1470 + if (ctl->op == &free_space_op) 1471 + block_group = ctl->private; 1493 1472 again: 1473 + /* 1474 + * Since we link bitmaps right into the cluster we need to see if we 1475 + * have a cluster here, and if so and it has our bitmap we need to add 1476 + * the free space to that bitmap. 1477 + */ 1478 + if (block_group && !list_empty(&block_group->cluster_list)) { 1479 + struct btrfs_free_cluster *cluster; 1480 + struct rb_node *node; 1481 + struct btrfs_free_space *entry; 1482 + 1483 + cluster = list_entry(block_group->cluster_list.next, 1484 + struct btrfs_free_cluster, 1485 + block_group_list); 1486 + spin_lock(&cluster->lock); 1487 + node = rb_first(&cluster->root); 1488 + if (!node) { 1489 + spin_unlock(&cluster->lock); 1490 + goto no_cluster_bitmap; 1491 + } 1492 + 1493 + entry = rb_entry(node, struct btrfs_free_space, offset_index); 1494 + if (!entry->bitmap) { 1495 + spin_unlock(&cluster->lock); 1496 + goto no_cluster_bitmap; 1497 + } 1498 + 1499 + if (entry->offset == offset_to_bitmap(ctl, offset)) { 1500 + bytes_added = add_bytes_to_bitmap(ctl, entry, 1501 + offset, bytes); 1502 + bytes -= bytes_added; 1503 + offset += bytes_added; 1504 + } 1505 + spin_unlock(&cluster->lock); 1506 + if (!bytes) { 1507 + ret = 1; 1508 + goto out; 1509 + } 1510 + } 1511 + 1512 + no_cluster_bitmap: 1494 1513 bitmap_info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), 1495 1514 1, 0); 1496 1515 if (!bitmap_info) { ··· 1540 1475 goto new_bitmap; 1541 1476 } 1542 1477 1543 - end = bitmap_info->offset + (u64)(BITS_PER_BITMAP * ctl->unit); 1544 - 1545 - if (offset >= bitmap_info->offset && offset + bytes > end) { 1546 - bitmap_set_bits(ctl, bitmap_info, offset, end - offset); 1547 - bytes -= end - offset; 1548 - offset = end; 1549 - added = 0; 1550 - } else if (offset >= bitmap_info->offset && offset + bytes <= end) { 1551 - bitmap_set_bits(ctl, bitmap_info, offset, bytes); 1552 - bytes = 0; 1553 - } else { 1554 - BUG(); 1555 - } 1478 + bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); 1479 + bytes -= bytes_added; 1480 + offset += bytes_added; 1481 + added = 0; 1556 1482 1557 1483 if (!bytes) { 1558 1484 ret = 1; ··· 1821 1765 printk(KERN_INFO "%d blocks of free space at or bigger than bytes is" 1822 1766 "\n", count); 1823 1767 } 1824 - 1825 - static struct btrfs_free_space_op free_space_op = { 1826 - .recalc_thresholds = recalculate_thresholds, 1827 - .use_bitmap = use_bitmap, 1828 - }; 1829 1768 1830 1769 void btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group) 1831 1770 { ··· 2193 2142 /* 2194 2143 * This searches the block group for just extents to fill the cluster with. 2195 2144 */ 2196 - static int setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group, 2197 - struct btrfs_free_cluster *cluster, 2198 - u64 offset, u64 bytes, u64 min_bytes) 2145 + static noinline int 2146 + setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group, 2147 + struct btrfs_free_cluster *cluster, 2148 + struct list_head *bitmaps, u64 offset, u64 bytes, 2149 + u64 min_bytes) 2199 2150 { 2200 2151 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; 2201 2152 struct btrfs_free_space *first = NULL; ··· 2219 2166 * extent entry. 2220 2167 */ 2221 2168 while (entry->bitmap) { 2169 + if (list_empty(&entry->list)) 2170 + list_add_tail(&entry->list, bitmaps); 2222 2171 node = rb_next(&entry->offset_index); 2223 2172 if (!node) 2224 2173 return -ENOSPC; ··· 2240 2185 return -ENOSPC; 2241 2186 entry = rb_entry(node, struct btrfs_free_space, offset_index); 2242 2187 2243 - if (entry->bitmap) 2188 + if (entry->bitmap) { 2189 + if (list_empty(&entry->list)) 2190 + list_add_tail(&entry->list, bitmaps); 2244 2191 continue; 2192 + } 2193 + 2245 2194 /* 2246 2195 * we haven't filled the empty size and the window is 2247 2196 * very large. reset and try again ··· 2297 2238 * This specifically looks for bitmaps that may work in the cluster, we assume 2298 2239 * that we have already failed to find extents that will work. 2299 2240 */ 2300 - static int setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, 2301 - struct btrfs_free_cluster *cluster, 2302 - u64 offset, u64 bytes, u64 min_bytes) 2241 + static noinline int 2242 + setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, 2243 + struct btrfs_free_cluster *cluster, 2244 + struct list_head *bitmaps, u64 offset, u64 bytes, 2245 + u64 min_bytes) 2303 2246 { 2304 2247 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; 2305 2248 struct btrfs_free_space *entry; ··· 2311 2250 if (ctl->total_bitmaps == 0) 2312 2251 return -ENOSPC; 2313 2252 2253 + /* 2254 + * First check our cached list of bitmaps and see if there is an entry 2255 + * here that will work. 2256 + */ 2257 + list_for_each_entry(entry, bitmaps, list) { 2258 + if (entry->bytes < min_bytes) 2259 + continue; 2260 + ret = btrfs_bitmap_cluster(block_group, entry, cluster, offset, 2261 + bytes, min_bytes); 2262 + if (!ret) 2263 + return 0; 2264 + } 2265 + 2266 + /* 2267 + * If we do have entries on our list and we are here then we didn't find 2268 + * anything, so go ahead and get the next entry after the last entry in 2269 + * this list and start the search from there. 2270 + */ 2271 + if (!list_empty(bitmaps)) { 2272 + entry = list_entry(bitmaps->prev, struct btrfs_free_space, 2273 + list); 2274 + node = rb_next(&entry->offset_index); 2275 + if (!node) 2276 + return -ENOSPC; 2277 + entry = rb_entry(node, struct btrfs_free_space, offset_index); 2278 + goto search; 2279 + } 2280 + 2314 2281 entry = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), 0, 1); 2315 2282 if (!entry) 2316 2283 return -ENOSPC; 2317 2284 2285 + search: 2318 2286 node = &entry->offset_index; 2319 2287 do { 2320 2288 entry = rb_entry(node, struct btrfs_free_space, offset_index); ··· 2374 2284 u64 offset, u64 bytes, u64 empty_size) 2375 2285 { 2376 2286 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; 2287 + struct list_head bitmaps; 2288 + struct btrfs_free_space *entry, *tmp; 2377 2289 u64 min_bytes; 2378 2290 int ret; 2379 2291 ··· 2414 2322 goto out; 2415 2323 } 2416 2324 2417 - ret = setup_cluster_no_bitmap(block_group, cluster, offset, bytes, 2418 - min_bytes); 2325 + INIT_LIST_HEAD(&bitmaps); 2326 + ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, 2327 + bytes, min_bytes); 2419 2328 if (ret) 2420 - ret = setup_cluster_bitmap(block_group, cluster, offset, 2421 - bytes, min_bytes); 2329 + ret = setup_cluster_bitmap(block_group, cluster, &bitmaps, 2330 + offset, bytes, min_bytes); 2331 + 2332 + /* Clear our temporary list */ 2333 + list_for_each_entry_safe(entry, tmp, &bitmaps, list) 2334 + list_del_init(&entry->list); 2422 2335 2423 2336 if (!ret) { 2424 2337 atomic_inc(&block_group->count);
+2 -2
fs/btrfs/inode.c
··· 1986 1986 } 1987 1987 1988 1988 if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM) 1989 - return 0; 1989 + goto good; 1990 1990 1991 1991 if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID && 1992 1992 test_range_bit(io_tree, start, end, EXTENT_NODATASUM, 1, NULL)) { ··· 3646 3646 btrfs_i_size_write(inode, 0); 3647 3647 3648 3648 while (1) { 3649 - trans = btrfs_start_transaction(root, 0); 3649 + trans = btrfs_join_transaction(root); 3650 3650 BUG_ON(IS_ERR(trans)); 3651 3651 trans->block_rsv = root->orphan_block_rsv; 3652 3652
+14 -9
fs/btrfs/ioctl.c
··· 2054 2054 2055 2055 static long btrfs_ioctl_fs_info(struct btrfs_root *root, void __user *arg) 2056 2056 { 2057 - struct btrfs_ioctl_fs_info_args fi_args; 2057 + struct btrfs_ioctl_fs_info_args *fi_args; 2058 2058 struct btrfs_device *device; 2059 2059 struct btrfs_device *next; 2060 2060 struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; 2061 + int ret = 0; 2061 2062 2062 2063 if (!capable(CAP_SYS_ADMIN)) 2063 2064 return -EPERM; 2064 2065 2065 - fi_args.num_devices = fs_devices->num_devices; 2066 - fi_args.max_id = 0; 2067 - memcpy(&fi_args.fsid, root->fs_info->fsid, sizeof(fi_args.fsid)); 2066 + fi_args = kzalloc(sizeof(*fi_args), GFP_KERNEL); 2067 + if (!fi_args) 2068 + return -ENOMEM; 2069 + 2070 + fi_args->num_devices = fs_devices->num_devices; 2071 + memcpy(&fi_args->fsid, root->fs_info->fsid, sizeof(fi_args->fsid)); 2068 2072 2069 2073 mutex_lock(&fs_devices->device_list_mutex); 2070 2074 list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) { 2071 - if (device->devid > fi_args.max_id) 2072 - fi_args.max_id = device->devid; 2075 + if (device->devid > fi_args->max_id) 2076 + fi_args->max_id = device->devid; 2073 2077 } 2074 2078 mutex_unlock(&fs_devices->device_list_mutex); 2075 2079 2076 - if (copy_to_user(arg, &fi_args, sizeof(fi_args))) 2077 - return -EFAULT; 2080 + if (copy_to_user(arg, fi_args, sizeof(*fi_args))) 2081 + ret = -EFAULT; 2078 2082 2079 - return 0; 2083 + kfree(fi_args); 2084 + return ret; 2080 2085 } 2081 2086 2082 2087 static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg)
+39 -30
fs/btrfs/scrub.c
··· 16 16 * Boston, MA 021110-1307, USA. 17 17 */ 18 18 19 - #include <linux/sched.h> 20 - #include <linux/pagemap.h> 21 - #include <linux/writeback.h> 22 19 #include <linux/blkdev.h> 23 - #include <linux/rbtree.h> 24 - #include <linux/slab.h> 25 - #include <linux/workqueue.h> 26 20 #include "ctree.h" 27 21 #include "volumes.h" 28 22 #include "disk-io.h" ··· 798 804 799 805 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 800 806 if (ret < 0) 801 - goto out; 807 + goto out_noplug; 802 808 803 - l = path->nodes[0]; 804 - slot = path->slots[0]; 805 - btrfs_item_key_to_cpu(l, &key, slot); 806 - if (key.objectid != logical) { 807 - ret = btrfs_previous_item(root, path, 0, 808 - BTRFS_EXTENT_ITEM_KEY); 809 - if (ret < 0) 810 - goto out; 811 - } 812 - 809 + /* 810 + * we might miss half an extent here, but that doesn't matter, 811 + * as it's only the prefetch 812 + */ 813 813 while (1) { 814 814 l = path->nodes[0]; 815 815 slot = path->slots[0]; ··· 812 824 if (ret == 0) 813 825 continue; 814 826 if (ret < 0) 815 - goto out; 827 + goto out_noplug; 816 828 817 829 break; 818 830 } ··· 894 906 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 895 907 if (ret < 0) 896 908 goto out; 897 - 898 - l = path->nodes[0]; 899 - slot = path->slots[0]; 900 - btrfs_item_key_to_cpu(l, &key, slot); 901 - if (key.objectid != logical) { 909 + if (ret > 0) { 902 910 ret = btrfs_previous_item(root, path, 0, 903 911 BTRFS_EXTENT_ITEM_KEY); 904 912 if (ret < 0) 905 913 goto out; 914 + if (ret > 0) { 915 + /* there's no smaller item, so stick with the 916 + * larger one */ 917 + btrfs_release_path(path); 918 + ret = btrfs_search_slot(NULL, root, &key, 919 + path, 0, 0); 920 + if (ret < 0) 921 + goto out; 922 + } 906 923 } 907 924 908 925 while (1) { ··· 982 989 983 990 out: 984 991 blk_finish_plug(&plug); 992 + out_noplug: 985 993 btrfs_free_path(path); 986 994 return ret < 0 ? ret : 0; 987 995 } ··· 1058 1064 while (1) { 1059 1065 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 1060 1066 if (ret < 0) 1061 - goto out; 1062 - ret = 0; 1067 + break; 1068 + if (ret > 0) { 1069 + if (path->slots[0] >= 1070 + btrfs_header_nritems(path->nodes[0])) { 1071 + ret = btrfs_next_leaf(root, path); 1072 + if (ret) 1073 + break; 1074 + } 1075 + } 1063 1076 1064 1077 l = path->nodes[0]; 1065 1078 slot = path->slots[0]; ··· 1076 1075 if (found_key.objectid != sdev->dev->devid) 1077 1076 break; 1078 1077 1079 - if (btrfs_key_type(&key) != BTRFS_DEV_EXTENT_KEY) 1078 + if (btrfs_key_type(&found_key) != BTRFS_DEV_EXTENT_KEY) 1080 1079 break; 1081 1080 1082 1081 if (found_key.offset >= end) ··· 1105 1104 cache = btrfs_lookup_block_group(fs_info, chunk_offset); 1106 1105 if (!cache) { 1107 1106 ret = -ENOENT; 1108 - goto out; 1107 + break; 1109 1108 } 1110 1109 ret = scrub_chunk(sdev, chunk_tree, chunk_objectid, 1111 1110 chunk_offset, length); ··· 1117 1116 btrfs_release_path(path); 1118 1117 } 1119 1118 1120 - out: 1121 1119 btrfs_free_path(path); 1122 - return ret; 1120 + 1121 + /* 1122 + * ret can still be 1 from search_slot or next_leaf, 1123 + * that's not an error 1124 + */ 1125 + return ret < 0 ? ret : 0; 1123 1126 } 1124 1127 1125 1128 static noinline_for_stack int scrub_supers(struct scrub_dev *sdev) ··· 1160 1155 struct btrfs_fs_info *fs_info = root->fs_info; 1161 1156 1162 1157 mutex_lock(&fs_info->scrub_lock); 1163 - if (fs_info->scrub_workers_refcnt == 0) 1158 + if (fs_info->scrub_workers_refcnt == 0) { 1159 + btrfs_init_workers(&fs_info->scrub_workers, "scrub", 1160 + fs_info->thread_pool_size, &fs_info->generic_worker); 1161 + fs_info->scrub_workers.idle_thresh = 4; 1164 1162 btrfs_start_workers(&fs_info->scrub_workers, 1); 1163 + } 1165 1164 ++fs_info->scrub_workers_refcnt; 1166 1165 mutex_unlock(&fs_info->scrub_lock); 1167 1166
+5 -2
fs/btrfs/transaction.c
··· 349 349 list) { 350 350 if (t->in_commit) { 351 351 if (t->commit_done) 352 - goto out; 352 + break; 353 353 cur_trans = t; 354 354 atomic_inc(&cur_trans->use_count); 355 355 break; ··· 1118 1118 wait_current_trans_commit_start_and_unblock(root, cur_trans); 1119 1119 else 1120 1120 wait_current_trans_commit_start(root, cur_trans); 1121 - put_transaction(cur_trans); 1122 1121 1122 + if (current->journal_info == trans) 1123 + current->journal_info = NULL; 1124 + 1125 + put_transaction(cur_trans); 1123 1126 return 0; 1124 1127 } 1125 1128
+2 -6
fs/btrfs/volumes.c
··· 689 689 transid = btrfs_super_generation(disk_super); 690 690 if (disk_super->label[0]) 691 691 printk(KERN_INFO "device label %s ", disk_super->label); 692 - else { 693 - /* FIXME, make a readl uuid parser */ 694 - printk(KERN_INFO "device fsid %llx-%llx ", 695 - *(unsigned long long *)disk_super->fsid, 696 - *(unsigned long long *)(disk_super->fsid + 8)); 697 - } 692 + else 693 + printk(KERN_INFO "device fsid %pU ", disk_super->fsid); 698 694 printk(KERN_CONT "devid %llu transid %llu %s\n", 699 695 (unsigned long long)devid, (unsigned long long)transid, path); 700 696 ret = device_list_add(path, disk_super, devid, fs_devices_ret);