From 63bcccee3683c68dbf63bb5e2cfbb9b22f9da369 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Thu, 10 Nov 2011 20:45:05 -0500 Subject: [PATCH] --- yaml --- r: 275327 b: refs/heads/master c: 2f120c05e67ae34c93786b1050c6828904314429 h: refs/heads/master i: 275325: a4f3df2e9cac4aec37fbf486474a1ad8b084b9c4 275323: 1340876f8e8d8fdd3abc13f5d3bd8ff42fe70b9f 275319: 7dd998b841ff0490978b27d8f8eeccce0cd5bb1a 275311: 1af534d50c6d984bc3567ae388fcef0107d052f3 275295: 07dcef63a65889bb711fd2dc1d57b8c745864940 275263: 49eafea8e7a38bbb688da1881a2d32c0725d3f3e 275199: cd56b3bbe1d809a8429a28d4e75cef940cb34c41 v: v3 --- [refs] | 2 +- trunk/fs/btrfs/free-space-cache.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 0ce826aa790b..8fe7316a49f7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 76b9e23d25d5c99f994bee3172de39492e452e93 +refs/heads/master: 2f120c05e67ae34c93786b1050c6828904314429 diff --git a/trunk/fs/btrfs/free-space-cache.c b/trunk/fs/btrfs/free-space-cache.c index 7a15fcfb3e1f..181760f9d2ab 100644 --- a/trunk/fs/btrfs/free-space-cache.c +++ b/trunk/fs/btrfs/free-space-cache.c @@ -537,6 +537,13 @@ static int io_ctl_read_entry(struct io_ctl *io_ctl, struct btrfs_free_space *entry, u8 *type) { struct btrfs_free_space_entry *e; + int ret; + + if (!io_ctl->cur) { + ret = io_ctl_check_crc(io_ctl, io_ctl->index); + if (ret) + return ret; + } e = io_ctl->cur; entry->offset = le64_to_cpu(e->offset); @@ -550,10 +557,7 @@ static int io_ctl_read_entry(struct io_ctl *io_ctl, io_ctl_unmap_page(io_ctl); - if (io_ctl->index >= io_ctl->num_pages) - return 0; - - return io_ctl_check_crc(io_ctl, io_ctl->index); + return 0; } static int io_ctl_read_bitmap(struct io_ctl *io_ctl, @@ -561,9 +565,6 @@ static int io_ctl_read_bitmap(struct io_ctl *io_ctl, { int ret; - if (io_ctl->cur && io_ctl->cur != io_ctl->orig) - io_ctl_unmap_page(io_ctl); - ret = io_ctl_check_crc(io_ctl, io_ctl->index); if (ret) return ret; @@ -699,6 +700,8 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, num_entries--; } + io_ctl_unmap_page(&io_ctl); + /* * We add the bitmaps at the end of the entries in order that * the bitmap entries are added to the cache.