diff options
| author | Andrew Morton <akpm@zip.com.au> | 2002-05-19 02:22:01 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2002-05-19 02:22:01 -0700 |
| commit | 1f6acea0de867d7f5e5a43ba43cf3be744da412c (patch) | |
| tree | 895e785d534e0b4965559493e80b361e9c4d0f80 /include | |
| parent | 610c5ab86ed7e1647ba3cedd20ab0f946b264c9d (diff) | |
[PATCH] pdflush exclusion infrastructure
Collision avoidance for pdflush threads.
Turns the request_queue-based `unsigned long ra_pages' into a structure
which contains ra_pages as well as a longword.
That longword is used to record the fact that a pdflush thread is
currently writing something back against this request_queue.
Avoids the situation where several pdflush threads are sleeping on the
same request_queue.
This patch provides only the infrastructure for the pdflush exclusion.
This infrastructure gets used in pdflush-single.patch
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/backing-dev.h | 30 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 9 | ||||
| -rw-r--r-- | include/linux/fs.h | 3 | ||||
| -rw-r--r-- | include/linux/mm.h | 1 |
4 files changed, 35 insertions, 8 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h new file mode 100644 index 000000000000..075cacc389e1 --- /dev/null +++ b/include/linux/backing-dev.h @@ -0,0 +1,30 @@ +/* + * include/linux/backing-dev.h + * + * low-level device information and state which is propagated up through + * to high-level code. + */ + +#ifndef _LINUX_BACKING_DEV_H +#define _LINUX_BACKING_DEV_H + +/* + * Bits in backing_dev_info.state + */ +enum bdi_state { + BDI_pdflush, /* A pdflush thread is working this device */ + BDI_unused, /* Available bits start here */ +}; + +struct backing_dev_info { + unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ + unsigned long state; /* Always use atomic bitops on this */ +}; + +extern struct backing_dev_info default_backing_dev_info; + +int writeback_acquire(struct backing_dev_info *bdi); +int writeback_in_progress(struct backing_dev_info *bdi); +void writeback_release(struct backing_dev_info *bdi); + +#endif /* _LINUX_BACKING_DEV_H */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d8175ccc104c..ac373e6a2454 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -7,6 +7,7 @@ #include <linux/tqueue.h> #include <linux/list.h> #include <linux/pagemap.h> +#include <linux/backing-dev.h> #include <asm/scatterlist.h> @@ -162,11 +163,7 @@ struct request_queue make_request_fn *make_request_fn; prep_rq_fn *prep_rq_fn; - /* - * The VM-level readahead tunable for this device. In - * units of PAGE_CACHE_SIZE pages. - */ - unsigned long ra_pages; + struct backing_dev_info backing_dev_info; /* * The queue owner gets to use this for whatever they like. @@ -328,7 +325,7 @@ extern void blk_queue_hardsect_size(request_queue_t *q, unsigned short); extern void blk_queue_segment_boundary(request_queue_t *q, unsigned long); extern void blk_queue_assign_lock(request_queue_t *q, spinlock_t *); extern void blk_queue_prep_rq(request_queue_t *q, prep_rq_fn *pfn); -extern unsigned long *blk_get_ra_pages(struct block_device *bdev); +extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); extern void blk_dump_rq_flags(struct request *, char *); diff --git a/include/linux/fs.h b/include/linux/fs.h index 25578c7a5e62..374045884cb8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -305,6 +305,7 @@ struct address_space_operations { int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int); }; +struct backing_dev_info; struct address_space { struct inode *host; /* owner: inode, block_device */ struct radix_tree_root page_tree; /* radix tree of all pages */ @@ -320,7 +321,7 @@ struct address_space { spinlock_t i_shared_lock; /* and spinlock protecting it */ unsigned long dirtied_when; /* jiffies of first page dirtying */ int gfp_mask; /* how to allocate the pages */ - unsigned long *ra_pages; /* device readahead */ + struct backing_dev_info *backing_dev_info; /* device readahead, etc */ spinlock_t private_lock; /* for use by the address_space */ struct list_head private_list; /* ditto */ struct address_space *assoc_mapping; /* ditto */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 2f0b56f0183b..451cdff1ec16 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -454,7 +454,6 @@ void do_page_cache_readahead(struct file *file, void page_cache_readahead(struct file *file, unsigned long offset); void page_cache_readaround(struct file *file, unsigned long offset); void handle_ra_thrashing(struct file *file); -extern unsigned long default_ra_pages; /* vma is the first one with address < vma->vm_end, * and even address < vma->vm_start. Have to extend vma. */ |
