summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2002-12-14 03:18:17 -0800
committerJaroslav Kysela <perex@suse.cz>2002-12-14 03:18:17 -0800
commit577c516f30df0f8a3d91e3beb68be3374ad25a8c (patch)
tree15589afab70e86c73244f0beba07ab5200bdedff /include
parent8725c3fccdf07ee30d1e5bac5b065c16e4632982 (diff)
[PATCH] remove PF_SYNC
current->flags:PF_SYNC was a hack I added because I didn't want to change all ->writepage implementations. It's foul. And it means that if someone happens to run direct page reclaim within the context of (say) sys_sync, the writepage invokations from the VM will be treated as "data integrity" operations, not "memory cleansing" operations, which would cause latency. So the patch removes PF_SYNC and adds an extra arg to a_ops->writepage. It is the `writeback_control' structure which contains the full context information about why writepage was called. The initial version of this patch just passed in a bare `int sync', but the XFS team need more info so they can perform writearound from within page reclaim. The patch also adds writeback_control.for_reclaim, so writepage implementations can inspect that to work out the call context rather than peeking at current->flags:PF_MEMALLOC.
Diffstat (limited to 'include')
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/sched.h5
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/writeback.h10
6 files changed, 8 insertions, 16 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 4e7a9bbf99dd..e9d6251fa168 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -178,7 +178,7 @@ extern int buffer_heads_over_limit;
*/
int try_to_release_page(struct page * page, int gfp_mask);
int block_invalidatepage(struct page *page, unsigned long offset);
-int block_write_full_page(struct page*, get_block_t*);
+int block_write_full_page(struct page *page, get_block_t *get_block, struct writeback_control *wbc);
int block_read_full_page(struct page*, get_block_t*);
int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index afbb9474f25b..bd133801c3e0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -278,7 +278,7 @@ struct address_space;
struct writeback_control;
struct address_space_operations {
- int (*writepage)(struct page *);
+ int (*writepage)(struct page *page, struct writeback_control *wbc);
int (*readpage)(struct file *, struct page *);
int (*sync_page)(struct page *);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8d15e17c0b94..2673e32cc4ba 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -291,7 +291,7 @@ extern void nfs_complete_unlink(struct dentry *);
/*
* linux/fs/nfs/write.c
*/
-extern int nfs_writepage(struct page *);
+extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
extern int nfs_writepages(struct address_space *, struct writeback_control *);
extern int nfs_flush_incompatible(struct file *file, struct page *page);
extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 80a9836df919..d0726cb87145 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -424,9 +424,8 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
#define PF_FREEZE 0x00008000 /* this task should be frozen for suspend */
#define PF_IOTHREAD 0x00010000 /* this thread is needed for doing I/O to swap */
#define PF_FROZEN 0x00020000 /* frozen for system suspend */
-#define PF_SYNC 0x00040000 /* performing fsync(), etc */
-#define PF_FSTRANS 0x00080000 /* inside a filesystem transaction */
-#define PF_KSWAPD 0x00100000 /* I am kswapd */
+#define PF_FSTRANS 0x00040000 /* inside a filesystem transaction */
+#define PF_KSWAPD 0x00080000 /* I am kswapd */
/*
* Ptrace flags
diff --git a/include/linux/swap.h b/include/linux/swap.h
index f6b1421f86b0..c635f392d6c1 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -65,6 +65,7 @@ typedef struct {
struct sysinfo;
struct address_space;
struct zone;
+struct writeback_control;
/*
* A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of
@@ -180,7 +181,7 @@ extern int shmem_unuse(swp_entry_t entry, struct page *page);
#ifdef CONFIG_SWAP
/* linux/mm/page_io.c */
extern int swap_readpage(struct file *, struct page *);
-extern int swap_writepage(struct page *);
+extern int swap_writepage(struct page *page, struct writeback_control *wbc);
extern int rw_swap_page_sync(int, swp_entry_t, struct page *);
/* linux/mm/swap_state.c */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 351e5851c041..620f18f5ceeb 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -42,6 +42,7 @@ struct writeback_control {
int nonblocking; /* Don't get stuck on request queues */
int encountered_congestion; /* An output: a queue is full */
int for_kupdate; /* A kupdate writeback */
+ int for_reclaim; /* Invoked from the page allocator */
};
/*
@@ -88,13 +89,4 @@ extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
read-only. */
-/*
- * Tell the writeback paths that they are being called for a "data integrity"
- * operation such as fsync().
- */
-static inline int called_for_sync(void)
-{
- return current->flags & PF_SYNC;
-}
-
#endif /* WRITEBACK_H */