diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-12 14:06:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-12 14:06:36 -0400 |
| commit | 3c25fa740e2084a3950f581378ec29a3c307ddfc (patch) | |
| tree | 0d41fe11789be7a406e4d29c111713f75548fbc1 | |
| parent | 9d6fa8fa7042622f8ed9c0988de665464d4584a6 (diff) | |
| parent | 30b4caf5d73af5c99cf1b2b46496d8bc35330992 (diff) | |
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
| -rw-r--r-- | fs/btrfs/ctree.c | 10 | ||||
| -rw-r--r-- | fs/btrfs/disk-io.c | 5 | ||||
| -rw-r--r-- | fs/btrfs/extent-tree.c | 55 | ||||
| -rw-r--r-- | fs/btrfs/extent_io.h | 2 | ||||
| -rw-r--r-- | fs/btrfs/free-space-cache.c | 163 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 4 | ||||
| -rw-r--r-- | fs/btrfs/ioctl.c | 23 | ||||
| -rw-r--r-- | fs/btrfs/scrub.c | 69 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 7 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 8 |
10 files changed, 233 insertions, 113 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index d84089349c82..2e667868e0d2 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -1228,6 +1228,7 @@ static void reada_for_search(struct btrfs_root *root, | |||
| 1228 | u32 nr; | 1228 | u32 nr; |
| 1229 | u32 blocksize; | 1229 | u32 blocksize; |
| 1230 | u32 nscan = 0; | 1230 | u32 nscan = 0; |
| 1231 | bool map = true; | ||
| 1231 | 1232 | ||
| 1232 | if (level != 1) | 1233 | if (level != 1) |
| 1233 | return; | 1234 | return; |
| @@ -1249,8 +1250,11 @@ static void reada_for_search(struct btrfs_root *root, | |||
| 1249 | 1250 | ||
| 1250 | nritems = btrfs_header_nritems(node); | 1251 | nritems = btrfs_header_nritems(node); |
| 1251 | nr = slot; | 1252 | nr = slot; |
| 1253 | if (node->map_token || path->skip_locking) | ||
| 1254 | map = false; | ||
| 1255 | |||
| 1252 | while (1) { | 1256 | while (1) { |
| 1253 | if (!node->map_token) { | 1257 | if (map && !node->map_token) { |
| 1254 | unsigned long offset = btrfs_node_key_ptr_offset(nr); | 1258 | unsigned long offset = btrfs_node_key_ptr_offset(nr); |
| 1255 | map_private_extent_buffer(node, offset, | 1259 | map_private_extent_buffer(node, offset, |
| 1256 | sizeof(struct btrfs_key_ptr), | 1260 | sizeof(struct btrfs_key_ptr), |
| @@ -1277,7 +1281,7 @@ static void reada_for_search(struct btrfs_root *root, | |||
| 1277 | if ((search <= target && target - search <= 65536) || | 1281 | if ((search <= target && target - search <= 65536) || |
| 1278 | (search > target && search - target <= 65536)) { | 1282 | (search > target && search - target <= 65536)) { |
| 1279 | gen = btrfs_node_ptr_generation(node, nr); | 1283 | gen = btrfs_node_ptr_generation(node, nr); |
| 1280 | if (node->map_token) { | 1284 | if (map && node->map_token) { |
| 1281 | unmap_extent_buffer(node, node->map_token, | 1285 | unmap_extent_buffer(node, node->map_token, |
| 1282 | KM_USER1); | 1286 | KM_USER1); |
| 1283 | node->map_token = NULL; | 1287 | node->map_token = NULL; |
| @@ -1289,7 +1293,7 @@ static void reada_for_search(struct btrfs_root *root, | |||
| 1289 | if ((nread > 65536 || nscan > 32)) | 1293 | if ((nread > 65536 || nscan > 32)) |
| 1290 | break; | 1294 | break; |
| 1291 | } | 1295 | } |
| 1292 | if (node->map_token) { | 1296 | if (map && node->map_token) { |
| 1293 | unmap_extent_buffer(node, node->map_token, KM_USER1); | 1297 | unmap_extent_buffer(node, node->map_token, KM_USER1); |
| 1294 | node->map_token = NULL; | 1298 | node->map_token = NULL; |
| 1295 | } | 1299 | } |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a203d363184d..9f68c6898653 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -1668,8 +1668,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1668 | init_waitqueue_head(&fs_info->scrub_pause_wait); | 1668 | init_waitqueue_head(&fs_info->scrub_pause_wait); |
| 1669 | init_rwsem(&fs_info->scrub_super_lock); | 1669 | init_rwsem(&fs_info->scrub_super_lock); |
| 1670 | fs_info->scrub_workers_refcnt = 0; | 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 | sb->s_blocksize = 4096; | 1672 | sb->s_blocksize = 4096; |
| 1675 | sb->s_blocksize_bits = blksize_bits(4096); | 1673 | sb->s_blocksize_bits = blksize_bits(4096); |
| @@ -2911,9 +2909,8 @@ static int btrfs_destroy_delalloc_inodes(struct btrfs_root *root) | |||
| 2911 | 2909 | ||
| 2912 | INIT_LIST_HEAD(&splice); | 2910 | INIT_LIST_HEAD(&splice); |
| 2913 | 2911 | ||
| 2914 | list_splice_init(&root->fs_info->delalloc_inodes, &splice); | ||
| 2915 | |||
| 2916 | spin_lock(&root->fs_info->delalloc_lock); | 2912 | spin_lock(&root->fs_info->delalloc_lock); |
| 2913 | list_splice_init(&root->fs_info->delalloc_inodes, &splice); | ||
| 2917 | 2914 | ||
| 2918 | while (!list_empty(&splice)) { | 2915 | while (!list_empty(&splice)) { |
| 2919 | btrfs_inode = list_entry(splice.next, struct btrfs_inode, | 2916 | btrfs_inode = list_entry(splice.next, struct btrfs_inode, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5b9b6b6df242..b42efc2ded51 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -3089,6 +3089,13 @@ alloc: | |||
| 3089 | } | 3089 | } |
| 3090 | goto again; | 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 | spin_unlock(&data_sinfo->lock); | 3099 | spin_unlock(&data_sinfo->lock); |
| 3093 | 3100 | ||
| 3094 | /* commit the current transaction and try again */ | 3101 | /* commit the current transaction and try again */ |
| @@ -5211,9 +5218,7 @@ loop: | |||
| 5211 | * LOOP_NO_EMPTY_SIZE, set empty_size and empty_cluster to 0 and try | 5218 | * LOOP_NO_EMPTY_SIZE, set empty_size and empty_cluster to 0 and try |
| 5212 | * again | 5219 | * again |
| 5213 | */ | 5220 | */ |
| 5214 | if (!ins->objectid && loop < LOOP_NO_EMPTY_SIZE && | 5221 | if (!ins->objectid && loop < LOOP_NO_EMPTY_SIZE) { |
| 5215 | (found_uncached_bg || empty_size || empty_cluster || | ||
| 5216 | allowed_chunk_alloc)) { | ||
| 5217 | index = 0; | 5222 | index = 0; |
| 5218 | if (loop == LOOP_FIND_IDEAL && found_uncached_bg) { | 5223 | if (loop == LOOP_FIND_IDEAL && found_uncached_bg) { |
| 5219 | found_uncached_bg = false; | 5224 | found_uncached_bg = false; |
| @@ -5253,32 +5258,36 @@ loop: | |||
| 5253 | goto search; | 5258 | goto search; |
| 5254 | } | 5259 | } |
| 5255 | 5260 | ||
| 5256 | if (loop < LOOP_CACHING_WAIT) { | 5261 | loop++; |
| 5257 | loop++; | ||
| 5258 | goto search; | ||
| 5259 | } | ||
| 5260 | 5262 | ||
| 5261 | if (loop == LOOP_ALLOC_CHUNK) { | 5263 | if (loop == LOOP_ALLOC_CHUNK) { |
| 5262 | empty_size = 0; | 5264 | if (allowed_chunk_alloc) { |
| 5263 | empty_cluster = 0; | 5265 | ret = do_chunk_alloc(trans, root, num_bytes + |
| 5264 | } | 5266 | 2 * 1024 * 1024, data, |
| 5267 | CHUNK_ALLOC_LIMITED); | ||
| 5268 | allowed_chunk_alloc = 0; | ||
| 5269 | if (ret == 1) | ||
| 5270 | done_chunk_alloc = 1; | ||
| 5271 | } else if (!done_chunk_alloc && | ||
| 5272 | space_info->force_alloc == | ||
| 5273 | CHUNK_ALLOC_NO_FORCE) { | ||
| 5274 | space_info->force_alloc = CHUNK_ALLOC_LIMITED; | ||
| 5275 | } | ||
| 5265 | 5276 | ||
| 5266 | if (allowed_chunk_alloc) { | 5277 | /* |
| 5267 | ret = do_chunk_alloc(trans, root, num_bytes + | 5278 | * We didn't allocate a chunk, go ahead and drop the |
| 5268 | 2 * 1024 * 1024, data, | 5279 | * empty size and loop again. |
| 5269 | CHUNK_ALLOC_LIMITED); | 5280 | */ |
| 5270 | allowed_chunk_alloc = 0; | 5281 | if (!done_chunk_alloc) |
| 5271 | done_chunk_alloc = 1; | 5282 | loop = LOOP_NO_EMPTY_SIZE; |
| 5272 | } else if (!done_chunk_alloc && | ||
| 5273 | space_info->force_alloc == CHUNK_ALLOC_NO_FORCE) { | ||
| 5274 | space_info->force_alloc = CHUNK_ALLOC_LIMITED; | ||
| 5275 | } | 5283 | } |
| 5276 | 5284 | ||
| 5277 | if (loop < LOOP_NO_EMPTY_SIZE) { | 5285 | if (loop == LOOP_NO_EMPTY_SIZE) { |
| 5278 | loop++; | 5286 | empty_size = 0; |
| 5279 | goto search; | 5287 | empty_cluster = 0; |
| 5280 | } | 5288 | } |
| 5281 | ret = -ENOSPC; | 5289 | |
| 5290 | goto search; | ||
| 5282 | } else if (!ins->objectid) { | 5291 | } else if (!ins->objectid) { |
| 5283 | ret = -ENOSPC; | 5292 | ret = -ENOSPC; |
| 5284 | } else if (ins->objectid) { | 5293 | } else if (ins->objectid) { |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 4e8445a4757c..a11a92ee2d30 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
| @@ -126,9 +126,9 @@ struct extent_buffer { | |||
| 126 | unsigned long map_len; | 126 | unsigned long map_len; |
| 127 | struct page *first_page; | 127 | struct page *first_page; |
