Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297892
b: refs/heads/master
c: e3176ca
h: refs/heads/master
v: v3
  • Loading branch information
Ilya Dryomov committed Mar 27, 2012
1 parent dc682d5 commit 5dc34ce
Show file tree
Hide file tree
Showing 40 changed files with 1,385 additions and 3,049 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: 1d4284bd6e8d7dd1d5521a6747bdb6dc1caf0225
refs/heads/master: e3176ca2769e420f64eba4b093bbddea6d7a89c3
15 changes: 10 additions & 5 deletions trunk/fs/btrfs/async-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ static void check_pending_worker_creates(struct btrfs_worker_thread *worker)
spin_unlock_irqrestore(&workers->lock, flags);
}

static noinline void run_ordered_completions(struct btrfs_workers *workers,
static noinline int run_ordered_completions(struct btrfs_workers *workers,
struct btrfs_work *work)
{
if (!workers->ordered)
return;
return 0;

set_bit(WORK_DONE_BIT, &work->flags);

Expand Down Expand Up @@ -213,6 +213,7 @@ static noinline void run_ordered_completions(struct btrfs_workers *workers,
}

spin_unlock(&workers->order_lock);
return 0;
}

static void put_worker(struct btrfs_worker_thread *worker)
Expand Down Expand Up @@ -398,7 +399,7 @@ static int worker_loop(void *arg)
/*
* this will wait for all the worker threads to shutdown
*/
void btrfs_stop_workers(struct btrfs_workers *workers)
int btrfs_stop_workers(struct btrfs_workers *workers)
{
struct list_head *cur;
struct btrfs_worker_thread *worker;
Expand Down Expand Up @@ -426,6 +427,7 @@ void btrfs_stop_workers(struct btrfs_workers *workers)
put_worker(worker);
}
spin_unlock_irq(&workers->lock);
return 0;
}

/*
Expand Down Expand Up @@ -613,14 +615,14 @@ static struct btrfs_worker_thread *find_worker(struct btrfs_workers *workers)
* it was taken from. It is intended for use with long running work functions
* that make some progress and want to give the cpu up for others.
*/
void btrfs_requeue_work(struct btrfs_work *work)
int btrfs_requeue_work(struct btrfs_work *work)
{
struct btrfs_worker_thread *worker = work->worker;
unsigned long flags;
int wake = 0;

if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags))
return;
goto out;

spin_lock_irqsave(&worker->lock, flags);
if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags))
Expand All @@ -647,6 +649,9 @@ void btrfs_requeue_work(struct btrfs_work *work)
if (wake)
wake_up_process(worker->task);
spin_unlock_irqrestore(&worker->lock, flags);
out:

return 0;
}

void btrfs_set_work_high_prio(struct btrfs_work *work)
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/btrfs/async-thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ struct btrfs_workers {

void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work);
int btrfs_start_workers(struct btrfs_workers *workers);
void btrfs_stop_workers(struct btrfs_workers *workers);
int btrfs_stop_workers(struct btrfs_workers *workers);
void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max,
struct btrfs_workers *async_starter);
void btrfs_requeue_work(struct btrfs_work *work);
int btrfs_requeue_work(struct btrfs_work *work);
void btrfs_set_work_high_prio(struct btrfs_work *work);
#endif
38 changes: 20 additions & 18 deletions trunk/fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ static void end_compressed_bio_read(struct bio *bio, int err)
* Clear the writeback bits on all of the file
* pages for a compressed write
*/
static noinline void end_compressed_writeback(struct inode *inode, u64 start,
unsigned long ram_size)
static noinline int end_compressed_writeback(struct inode *inode, u64 start,
unsigned long ram_size)
{
unsigned long index = start >> PAGE_CACHE_SHIFT;
unsigned long end_index = (start + ram_size - 1) >> PAGE_CACHE_SHIFT;
Expand All @@ -253,6 +253,7 @@ static noinline void end_compressed_writeback(struct inode *inode, u64 start,
index += ret;
}
/* the inode may be gone now */
return 0;
}

/*
Expand Down Expand Up @@ -391,16 +392,16 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
*/
atomic_inc(&cb->pending_bios);
ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

if (!skip_sum) {
ret = btrfs_csum_one_bio(root, inode, bio,
start, 1);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);
}

ret = btrfs_map_bio(root, WRITE, bio, 0, 1);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

bio_put(bio);

Expand All @@ -420,15 +421,15 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
bio_get(bio);

ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

if (!skip_sum) {
ret = btrfs_csum_one_bio(root, inode, bio, start, 1);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);
}

ret = btrfs_map_bio(root, WRITE, bio, 0, 1);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

bio_put(bio);
return 0;
Expand Down Expand Up @@ -496,7 +497,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
* sure they map to this compressed extent on disk.
*/
set_page_extent_mapped(page);
lock_extent(tree, last_offset, end);
lock_extent(tree, last_offset, end, GFP_NOFS);
read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, last_offset,
PAGE_CACHE_SIZE);
Expand All @@ -506,7 +507,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
(last_offset + PAGE_CACHE_SIZE > extent_map_end(em)) ||
(em->block_start >> 9) != cb->orig_bio->bi_sector) {
free_extent_map(em);
unlock_extent(tree, last_offset, end);
unlock_extent(tree, last_offset, end, GFP_NOFS);
unlock_page(page);
page_cache_release(page);
break;
Expand Down Expand Up @@ -534,7 +535,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
nr_pages++;
page_cache_release(page);
} else {
unlock_extent(tree, last_offset, end);
unlock_extent(tree, last_offset, end, GFP_NOFS);
unlock_page(page);
page_cache_release(page);
break;
Expand Down Expand Up @@ -661,7 +662,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
bio_get(comp_bio);

ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, 0);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

/*
* inc the count before we submit the bio so
Expand All @@ -674,14 +675,14 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) {
ret = btrfs_lookup_bio_sums(root, inode,
comp_bio, sums);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);
}
sums += (comp_bio->bi_size + root->sectorsize - 1) /
root->sectorsize;

ret = btrfs_map_bio(root, READ, comp_bio,
mirror_num, 0);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

bio_put(comp_bio);

Expand All @@ -697,15 +698,15 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
bio_get(comp_bio);

ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, 0);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) {
ret = btrfs_lookup_bio_sums(root, inode, comp_bio, sums);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);
}

ret = btrfs_map_bio(root, READ, comp_bio, mirror_num, 0);
BUG_ON(ret); /* -ENOMEM */
BUG_ON(ret);

bio_put(comp_bio);
return 0;
Expand Down Expand Up @@ -733,7 +734,7 @@ struct btrfs_compress_op *btrfs_compress_op[] = {
&btrfs_lzo_compress,
};

void __init btrfs_init_compress(void)
int __init btrfs_init_compress(void)
{
int i;

Expand All @@ -743,6 +744,7 @@ void __init btrfs_init_compress(void)
atomic_set(&comp_alloc_workspace[i], 0);
init_waitqueue_head(&comp_workspace_wait[i]);
}
return 0;
}

/*
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 @@ -19,7 +19,7 @@
#ifndef __BTRFS_COMPRESSION_
#define __BTRFS_COMPRESSION_

void btrfs_init_compress(void);
int btrfs_init_compress(void);
void btrfs_exit_compress(void);

int btrfs_compress_pages(int type, struct address_space *mapping,
Expand Down
Loading

0 comments on commit 5dc34ce

Please sign in to comment.