X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=fs%2Fbtrfs%2Finode-map.c;h=ffca2abf13d0cb241e0c0a0e12ba44c91d924ddc;hb=532c2b926dda11174700333a5dda5e3c0ee383f2;hp=12fcd8897c3368dfd88f4dd2756540e76a5f0cf3;hpb=071db7a6759d5d0a85ecf6a600ac1f9caa7f6404;p=linux-2.6-microblaze.git diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 12fcd8897c33..ffca2abf13d0 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -3,7 +3,6 @@ * Copyright (C) 2007 Oracle. All rights reserved. */ -#include #include #include @@ -244,8 +243,6 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) return; while (1) { - bool add_to_ctl = true; - spin_lock(rbroot_lock); n = rb_first(rbroot); if (!n) { @@ -257,15 +254,14 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) BUG_ON(info->bitmap); /* Logic error */ if (info->offset > root->ino_cache_progress) - add_to_ctl = false; - else if (info->offset + info->bytes > root->ino_cache_progress) - count = root->ino_cache_progress - info->offset + 1; + count = 0; else - count = info->bytes; + count = min(root->ino_cache_progress - info->offset + 1, + info->bytes); rb_erase(&info->offset_index, rbroot); spin_unlock(rbroot_lock); - if (add_to_ctl) + if (count) __btrfs_add_free_space(root->fs_info, ctl, info->offset, count); kmem_cache_free(btrfs_free_space_cachep, info);