Btrfs: simplify iteration codes
[linux-2.6-block.git] / fs / btrfs / inode.c
index 4e57fe68e4b9365858489e0506a4c6e290e8d242..45cf03ee1bc2281ba17cd96ed246536a24c6d48f 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/statfs.h>
 #include <linux/compat.h>
 #include <linux/bit_spinlock.h>
-#include <linux/version.h>
 #include <linux/xattr.h>
 #include <linux/posix_acl.h>
 #include <linux/falloc.h>
@@ -1324,12 +1323,11 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
                             struct inode *inode, u64 file_offset,
                             struct list_head *list)
 {
-       struct list_head *cur;
        struct btrfs_ordered_sum *sum;
 
        btrfs_set_trans_block_group(trans, inode);
-       list_for_each(cur, list) {
-               sum = list_entry(cur, struct btrfs_ordered_sum, list);
+
+       list_for_each_entry(sum, list, list) {
                btrfs_csum_file_blocks(trans,
                       BTRFS_I(inode)->root->fs_info->csum_root, sum);
        }
@@ -1727,7 +1725,6 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
        int ret;
        struct btrfs_root *root = BTRFS_I(inode)->root;
        u32 csum = ~(u32)0;
-       unsigned long flags;
 
        if (PageChecked(page)) {
                ClearPageChecked(page);
@@ -1749,8 +1746,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
        } else {
                ret = get_state_private(io_tree, start, &private);
        }
-       local_irq_save(flags);
-       kaddr = kmap_atomic(page, KM_IRQ0);
+       kaddr = kmap_atomic(page, KM_USER0);
        if (ret)
                goto zeroit;
 
@@ -1759,8 +1755,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
        if (csum != private)
                goto zeroit;
 
-       kunmap_atomic(kaddr, KM_IRQ0);
-       local_irq_restore(flags);
+       kunmap_atomic(kaddr, KM_USER0);
 good:
        /* if the io failure tree for this inode is non-empty,
         * check to see if we've recovered from a failed IO
@@ -1775,8 +1770,7 @@ zeroit:
               (unsigned long long)private);
        memset(kaddr + offset, 1, end - start + 1);
        flush_dcache_page(page);
-       kunmap_atomic(kaddr, KM_IRQ0);
-       local_irq_restore(flags);
+       kunmap_atomic(kaddr, KM_USER0);
        if (private == 0)
                return 0;
        return -EIO;