/* * 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 */structwb_writeback_work{longnr_pages;structsuper_block*sb;unsignedlong*older_than_this;enumwriteback_sync_modessync_mode;unsignedinttagged_writepages:1;unsignedintfor_kupdate:1;unsignedintrange_cyclic:1;unsignedintfor_background:1;unsignedintfor_sync:1;/* sync(2) WB_SYNC_ALL writeback */enumwb_reasonreason;/* why was writeback initiated? */structlist_headlist;/* pending work list */structcompletion*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(structbacking_dev_info*bdi){