Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252323
b: refs/heads/master
c: 0956c79
h: refs/heads/master
i:
  252321: ed1ed3c
  252319: 8ec786d
v: v3
  • Loading branch information
Andi Kleen authored and Chris Mason committed May 23, 2011
1 parent 5be2c89 commit d4c9741
Show file tree
Hide file tree
Showing 47 changed files with 4,407 additions and 5,732 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e531cdfeb75269c6c5aae33651cca39707848da
refs/heads/master: 0956c798ef8dbe0fc215870eb68bd2d8e789f86a
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
export.o tree-log.o acl.o free-space-cache.o zlib.o lzo.o \
compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o
compression.o delayed-ref.o relocation.o
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ int btrfs_acl_chmod(struct inode *inode)
return 0;

acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
if (IS_ERR_OR_NULL(acl))
if (IS_ERR(acl) || !acl)
return PTR_ERR(acl);

clone = posix_acl_clone(acl, GFP_KERNEL);
Expand Down
14 changes: 0 additions & 14 deletions trunk/fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "extent_map.h"
#include "extent_io.h"
#include "ordered-data.h"
#include "delayed-inode.h"

/* in memory btrfs inode */
struct btrfs_inode {
Expand Down Expand Up @@ -159,27 +158,14 @@ struct btrfs_inode {
*/
unsigned force_compress:4;

struct btrfs_delayed_node *delayed_node;

struct inode vfs_inode;
};

extern unsigned char btrfs_filetype_table[];

static inline struct btrfs_inode *BTRFS_I(struct inode *inode)
{
return container_of(inode, struct btrfs_inode, vfs_inode);
}

static inline u64 btrfs_ino(struct inode *inode)
{
u64 ino = BTRFS_I(inode)->location.objectid;

if (ino <= BTRFS_FIRST_FREE_OBJECTID)
ino = inode->i_ino;
return ino;
}

static inline void btrfs_i_size_write(struct inode *inode, u64 size)
{
i_size_write(inode, size);
Expand Down
47 changes: 23 additions & 24 deletions trunk/fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,9 @@ static int check_compressed_csum(struct inode *inode,
kunmap_atomic(kaddr, KM_USER0);

if (csum != *cb_sum) {
printk(KERN_INFO "btrfs csum failed ino %llu "
printk(KERN_INFO "btrfs csum failed ino %lu "
"extent %llu csum %u "
"wanted %u mirror %d\n",
(unsigned long long)btrfs_ino(inode),
"wanted %u mirror %d\n", inode->i_ino,
(unsigned long long)disk_start,
csum, *cb_sum, cb->mirror_num);
ret = -EIO;
Expand Down Expand Up @@ -333,7 +332,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
struct compressed_bio *cb;
unsigned long bytes_left;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
int pg_index = 0;
int page_index = 0;
struct page *page;
u64 first_byte = disk_start;
struct block_device *bdev;
Expand Down Expand Up @@ -367,8 +366,8 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,

/* create and submit bios for the compressed pages */
bytes_left = compressed_len;
for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) {
page = compressed_pages[pg_index];
for (page_index = 0; page_index < cb->nr_pages; page_index++) {
page = compressed_pages[page_index];
page->mapping = inode->i_mapping;
if (bio->bi_size)
ret = io_tree->ops->merge_bio_hook(page, 0,
Expand Down Expand Up @@ -433,7 +432,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
struct compressed_bio *cb)
{
unsigned long end_index;
unsigned long pg_index;
unsigned long page_index;
u64 last_offset;
u64 isize = i_size_read(inode);
int ret;
Expand All @@ -457,13 +456,13 @@ static noinline int add_ra_bio_pages(struct inode *inode,
end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT;

while (last_offset < compressed_end) {
pg_index = last_offset >> PAGE_CACHE_SHIFT;
page_index = last_offset >> PAGE_CACHE_SHIFT;

if (pg_index > end_index)
if (page_index > end_index)
break;

rcu_read_lock();
page = radix_tree_lookup(&mapping->page_tree, pg_index);
page = radix_tree_lookup(&mapping->page_tree, page_index);
rcu_read_unlock();
if (page) {
misses++;
Expand All @@ -477,7 +476,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
if (!page)
break;

if (add_to_page_cache_lru(page, mapping, pg_index,
if (add_to_page_cache_lru(page, mapping, page_index,
GFP_NOFS)) {
page_cache_release(page);
goto next;
Expand Down Expand Up @@ -561,7 +560,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
unsigned long uncompressed_len = bio->bi_vcnt * PAGE_CACHE_SIZE;
unsigned long compressed_len;
unsigned long nr_pages;
unsigned long pg_index;
unsigned long page_index;
struct page *page;
struct block_device *bdev;
struct bio *comp_bio;
Expand Down Expand Up @@ -614,10 +613,10 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,

bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev;

for (pg_index = 0; pg_index < nr_pages; pg_index++) {
cb->compressed_pages[pg_index] = alloc_page(GFP_NOFS |
for (page_index = 0; page_index < nr_pages; page_index++) {
cb->compressed_pages[page_index] = alloc_page(GFP_NOFS |
__GFP_HIGHMEM);
if (!cb->compressed_pages[pg_index])
if (!cb->compressed_pages[page_index])
goto fail2;
}
cb->nr_pages = nr_pages;
Expand All @@ -635,8 +634,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
comp_bio->bi_end_io = end_compressed_bio_read;
atomic_inc(&cb->pending_bios);

for (pg_index = 0; pg_index < nr_pages; pg_index++) {
page = cb->compressed_pages[pg_index];
for (page_index = 0; page_index < nr_pages; page_index++) {
page = cb->compressed_pages[page_index];
page->mapping = inode->i_mapping;
page->index = em_start >> PAGE_CACHE_SHIFT;

Expand Down Expand Up @@ -703,8 +702,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
return 0;

fail2:
for (pg_index = 0; pg_index < nr_pages; pg_index++)
free_page((unsigned long)cb->compressed_pages[pg_index]);
for (page_index = 0; page_index < nr_pages; page_index++)
free_page((unsigned long)cb->compressed_pages[page_index]);

kfree(cb->compressed_pages);
fail1:
Expand Down Expand Up @@ -946,7 +945,7 @@ void btrfs_exit_compress(void)
int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
unsigned long total_out, u64 disk_start,
struct bio_vec *bvec, int vcnt,
unsigned long *pg_index,
unsigned long *page_index,
unsigned long *pg_offset)
{
unsigned long buf_offset;
Expand All @@ -955,7 +954,7 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
unsigned long working_bytes = total_out - buf_start;
unsigned long bytes;
char *kaddr;
struct page *page_out = bvec[*pg_index].bv_page;
struct page *page_out = bvec[*page_index].bv_page;

/*
* start byte is the first byte of the page we're currently
Expand Down Expand Up @@ -996,11 +995,11 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,

/* check if we need to pick another page */
if (*pg_offset == PAGE_CACHE_SIZE) {
(*pg_index)++;
if (*pg_index >= vcnt)
(*page_index)++;
if (*page_index >= vcnt)
return 0;

page_out = bvec[*pg_index].bv_page;
page_out = bvec[*page_index].bv_page;
*pg_offset = 0;
start_byte = page_offset(page_out) - disk_start;

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
unsigned long total_out, u64 disk_start,
struct bio_vec *bvec, int vcnt,
unsigned long *pg_index,
unsigned long *page_index,
unsigned long *pg_offset);

int btrfs_submit_compressed_write(struct inode *inode, u64 start,
Expand Down
43 changes: 25 additions & 18 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ static int balance_node_right(struct btrfs_trans_handle *trans,
struct extent_buffer *src_buf);
static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_path *path, int level, int slot);
static int setup_items_for_insert(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size,
u32 total_data, u32 total_size, int nr);


struct btrfs_path *btrfs_alloc_path(void)
{
Expand Down Expand Up @@ -102,7 +107,7 @@ void btrfs_free_path(struct btrfs_path *p)
{
if (!p)
return;
btrfs_release_path(p);
btrfs_release_path(NULL, p);
kmem_cache_free(btrfs_path_cachep, p);
}

Expand All @@ -112,7 +117,7 @@ void btrfs_free_path(struct btrfs_path *p)
*
* It is safe to call this on paths that no locks or extent buffers held.
*/
noinline void btrfs_release_path(struct btrfs_path *p)
noinline void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p)
{
int i;

Expand Down Expand Up @@ -1323,7 +1328,7 @@ static noinline int reada_for_balance(struct btrfs_root *root,
ret = -EAGAIN;

/* release the whole path */
btrfs_release_path(path);
btrfs_release_path(root, path);

/* read the blocks */
if (block1)
Expand Down Expand Up @@ -1470,7 +1475,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
return 0;
}
free_extent_buffer(tmp);
btrfs_release_path(p);
btrfs_release_path(NULL, p);
return -EIO;
}
}
Expand All @@ -1489,7 +1494,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
if (p->reada)
reada_for_search(root, p, level, slot, key->objectid);

btrfs_release_path(p);
btrfs_release_path(NULL, p);

ret = -EAGAIN;
tmp = read_tree_block(root, blocknr, blocksize, 0);
Expand Down Expand Up @@ -1558,7 +1563,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans,
}
b = p->nodes[level];
if (!b) {
btrfs_release_path(p);
btrfs_release_path(NULL, p);
goto again;
}
BUG_ON(btrfs_header_nritems(b) == 1);
Expand Down Expand Up @@ -1748,7 +1753,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
if (!p->leave_spinning)
btrfs_set_path_blocking(p);
if (ret < 0)
btrfs_release_path(p);
btrfs_release_path(root, p);
return ret;
}

Expand Down Expand Up @@ -3021,7 +3026,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans,
struct btrfs_file_extent_item);
extent_len = btrfs_file_extent_num_bytes(leaf, fi);
}
btrfs_release_path(path);
btrfs_release_path(root, path);

path->keep_locks = 1;
path->search_for_split = 1;
Expand Down Expand Up @@ -3554,10 +3559,11 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
* to save stack depth by doing the bulk of the work in a function
* that doesn't call btrfs_search_slot
*/
int setup_items_for_insert(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size,
u32 total_data, u32 total_size, int nr)
static noinline_for_stack int
setup_items_for_insert(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size,
u32 total_data, u32 total_size, int nr)
{
struct btrfs_item *item;
int i;
Expand Down Expand Up @@ -3641,6 +3647,7 @@ int setup_items_for_insert(struct btrfs_trans_handle *trans,

ret = 0;
if (slot == 0) {
struct btrfs_disk_key disk_key;
btrfs_cpu_key_to_disk(&disk_key, cpu_key);
ret = fixup_low_keys(trans, root, path, &disk_key, 1);
}
Expand Down Expand Up @@ -3942,7 +3949,7 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
else
return 1;

btrfs_release_path(path);
btrfs_release_path(root, path);
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -4066,7 +4073,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
sret = btrfs_find_next_key(root, path, min_key, level,
cache_only, min_trans);
if (sret == 0) {
btrfs_release_path(path);
btrfs_release_path(root, path);
goto again;
} else {
goto out;
Expand Down Expand Up @@ -4145,7 +4152,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
btrfs_node_key_to_cpu(c, &cur_key, slot);

orig_lowest = path->lowest_level;
btrfs_release_path(path);
btrfs_release_path(root, path);
path->lowest_level = level;
ret = btrfs_search_slot(NULL, root, &cur_key, path,
0, 0);
Expand Down Expand Up @@ -4222,7 +4229,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
again:
level = 1;
next = NULL;
btrfs_release_path(path);
btrfs_release_path(root, path);

path->keep_locks = 1;

Expand Down Expand Up @@ -4278,7 +4285,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
goto again;

if (ret < 0) {
btrfs_release_path(path);
btrfs_release_path(root, path);
goto done;
}

Expand Down Expand Up @@ -4317,7 +4324,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
goto again;

if (ret < 0) {
btrfs_release_path(path);
btrfs_release_path(root, path);
goto done;
}

Expand Down
Loading

0 comments on commit d4c9741

Please sign in to comment.