Merge branch 'misc-for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[cascardo/linux.git] / fs / btrfs / ioctl.c
index b20463b..83c9ad3 100644 (file)
@@ -1005,7 +1005,7 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start)
                u64 end = start + len - 1;
 
                /* get the big lock and read metadata off disk */
-               lock_extent_bits(io_tree, start, end, 0, &cached);
+               lock_extent_bits(io_tree, start, end, &cached);
                em = btrfs_get_extent(inode, NULL, 0, start, len, 0);
                unlock_extent_cached(io_tree, start, end, &cached, GFP_NOFS);
 
@@ -1029,7 +1029,7 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em)
        if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE)
                ret = false;
        else if ((em->block_start + em->block_len == next->block_start) &&
-                (em->block_len > 128 * 1024 && next->block_len > 128 * 1024))
+                (em->block_len > SZ_128K && next->block_len > SZ_128K))
                ret = false;
 
        free_extent_map(next);
@@ -1153,7 +1153,7 @@ again:
                page_end = page_start + PAGE_CACHE_SIZE - 1;
                while (1) {
                        lock_extent_bits(tree, page_start, page_end,
-                                        0, &cached_state);
+                                        &cached_state);
                        ordered = btrfs_lookup_ordered_extent(inode,
                                                              page_start);
                        unlock_extent_cached(tree, page_start, page_end,
@@ -1213,7 +1213,7 @@ again:
        page_end = page_offset(pages[i_done - 1]) + PAGE_CACHE_SIZE;
 
        lock_extent_bits(&BTRFS_I(inode)->io_tree,
-                        page_start, page_end - 1, 0, &cached_state);
+                        page_start, page_end - 1, &cached_state);
        clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start,
                          page_end - 1, EXTENT_DIRTY | EXTENT_DELALLOC |
                          EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, 0, 0,
@@ -1275,9 +1275,9 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
        int defrag_count = 0;
        int compress_type = BTRFS_COMPRESS_ZLIB;
        u32 extent_thresh = range->extent_thresh;
-       unsigned long max_cluster = (256 * 1024) >> PAGE_CACHE_SHIFT;
+       unsigned long max_cluster = SZ_256K >> PAGE_CACHE_SHIFT;
        unsigned long cluster = max_cluster;
-       u64 new_align = ~((u64)128 * 1024 - 1);
+       u64 new_align = ~((u64)SZ_128K - 1);
        struct page **pages = NULL;
 
        if (isize == 0)
@@ -1294,7 +1294,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
        }
 
        if (extent_thresh == 0)
-               extent_thresh = 256 * 1024;
+               extent_thresh = SZ_256K;
 
        /*
         * if we were not given a file, allocate a readahead
@@ -1326,7 +1326,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
 
        if (newer_than) {
                ret = find_new_extents(root, inode, newer_than,
-                                      &newer_off, 64 * 1024);
+                                      &newer_off, SZ_64K);
                if (!ret) {
                        range->start = newer_off;
                        /*
@@ -1416,9 +1416,8 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
                        newer_off = max(newer_off + 1,
                                        (u64)i << PAGE_CACHE_SHIFT);
 
-                       ret = find_new_extents(root, inode,
-                                              newer_than, &newer_off,
-                                              64 * 1024);
+                       ret = find_new_extents(root, inode, newer_than,
+                                              &newer_off, SZ_64K);
                        if (!ret) {
                                range->start = newer_off;
                                i = (newer_off & new_align) >> PAGE_CACHE_SHIFT;
@@ -1584,7 +1583,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
                new_size = old_size + new_size;
        }
 
-       if (new_size < 256 * 1024 * 1024) {
+       if (new_size < SZ_256M) {
                ret = -EINVAL;
                goto out_free;
        }
@@ -2173,7 +2172,7 @@ static noinline int btrfs_ioctl_tree_search_v2(struct file *file,
        struct inode *inode;
        int ret;
        size_t buf_size;
-       const size_t buf_limit = 16 * 1024 * 1024;
+       const size_t buf_limit = SZ_16M;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -3109,7 +3108,7 @@ out_unlock:
        return ret;
 }
 
-#define BTRFS_MAX_DEDUPE_LEN   (16 * 1024 * 1024)
+#define BTRFS_MAX_DEDUPE_LEN   SZ_16M
 
 static long btrfs_ioctl_file_extent_same(struct file *file,
                        struct btrfs_ioctl_same_args __user *argp)
@@ -4160,7 +4159,7 @@ static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
                return -ENOMEM;
 
        space_args.total_spaces = 0;
-       dest = kmalloc(alloc_size, GFP_NOFS);
+       dest = kmalloc(alloc_size, GFP_KERNEL);
        if (!dest)
                return -ENOMEM;
        dest_orig = dest;
@@ -4537,7 +4536,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
                goto out;
        }
 
-       size = min_t(u32, loi->size, 64 * 1024);
+       size = min_t(u32, loi->size, SZ_64K);
        inodes = init_data_container(size);
        if (IS_ERR(inodes)) {
                ret = PTR_ERR(inodes);
@@ -4686,7 +4685,7 @@ locked:
                goto out_bargs;
        }
 
-       bctl = kzalloc(sizeof(*bctl), GFP_NOFS);
+       bctl = kzalloc(sizeof(*bctl), GFP_KERNEL);
        if (!bctl) {
                ret = -ENOMEM;
                goto out_bargs;
@@ -4772,7 +4771,7 @@ static long btrfs_ioctl_balance_progress(struct btrfs_root *root,
                goto out;
        }
 
-       bargs = kzalloc(sizeof(*bargs), GFP_NOFS);
+       bargs = kzalloc(sizeof(*bargs), GFP_KERNEL);
        if (!bargs) {
                ret = -ENOMEM;
                goto out;
@@ -5032,7 +5031,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       qsa = kzalloc(sizeof(*qsa), GFP_NOFS);
+       qsa = kzalloc(sizeof(*qsa), GFP_KERNEL);
        if (!qsa)
                return -ENOMEM;
 
@@ -5162,7 +5161,7 @@ static long btrfs_ioctl_set_received_subvol_32(struct file *file,
                goto out;
        }
 
-       args64 = kmalloc(sizeof(*args64), GFP_NOFS);
+       args64 = kmalloc(sizeof(*args64), GFP_KERNEL);
        if (!args64) {
                ret = -ENOMEM;
                goto out;