/* * fs/fs-writeback.c * * Copyright (C) 2002, Linus Torvalds. * * Contains all the functions related to writing back and waiting * upon dirty inodes against superblocks, and writing back dirty * pages against inodes. ie: data writeback. Writeout of the * inode itself is not handled here. * * 10Apr2002 Andrew Morton * Split out of fs/inode.c * Additions for address_space-based writeback */#include <linux/kernel.h>#include <linux/export.h>#include <linux/spinlock.h>#include <linux/slab.h>#include <linux/sched.h>#include <linux/fs.h>#include <linux/mm.h>#include <linux/pagemap.h>#include <linux/kthread.h>#include <linux/writeback.h>#include <linux/blkdev.h>#include <linux/backing-dev.h>#include <linux/tracepoint.h>#include <linux/device.h>#include"internal.h"/* * 4MB minimal write chunk size */#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10))/* * Passed into wb_writeback(), essentially a subset of writeback_control */struct wb_writeback_work {long nr_pages;struct super_block *sb;/* * Write only inodes dirtied before this time. Don't forget to set * older_than_this_is_set when you set this. */unsigned long older_than_this;enum writeback_sync_modes sync_mode;unsigned int tagged_writepages:1;unsigned int for_kupdate:1;unsigned int range_cyclic:1;unsigned int for_background:1;unsigned int for_sync:1;/* sync(2) WB_SYNC_ALL writeback */unsigned int older_than_this_is_set:1;enum wb_reason reason;/* why was writeback initiated? */struct list_head list;/* pending work list */struct completion *done;/* set if the caller waits */};/** * writeback_in_progress - determine whether there is writeback in progress * @bdi: the device's backing_dev_info structure. * * Determine whether there is writeback waiting to be handled against a * backing device. */intwriteback_in_progress(struct backing_dev_info *bdi){returntest_bit(BDI_writeback_running, &bdi->state);}EXPORT_SYMBOL