Skip to content
Snippets Groups Projects
Select Git revision
  • f9ed72dde34e3d5253e206e4bc3edbc6373015d6
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

fs-writeback.c

Blame
  • fs-writeback.c 67.31 KiB
    /*
     * 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 <linux/memcontrol.h>
    #include "internal.h"
    
    /*
     * 4MB minimal write chunk size
     */
    #define MIN_WRITEBACK_PAGES	(4096UL >> (PAGE_CACHE_SHIFT - 10))
    
    struct wb_completion {
    	atomic_t		cnt;
    };
    
    /*
     * Passed into wb_writeback(), essentially a subset of writeback_control
     */
    struct wb_writeback_work {
    	long nr_pages;
    	struct super_block *sb;
    	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 auto_free:1;	/* free on completion */
    	unsigned int single_wait:1;
    	unsigned int single_done:1;
    	enum wb_reason reason;		/* why was writeback initiated? */
    
    	struct list_head list;		/* pending work list */
    	struct wb_completion *done;	/* set if the caller waits */
    };
    
    /*
     * If one wants to wait for one or more wb_writeback_works, each work's
     * ->done should be set to a wb_completion defined using the following
     * macro.  Once all work items are issued with wb_queue_work(), the caller
     * can wait for the completion of all using wb_wait_for_completion().  Work
     * items which are waited upon aren't freed automatically on completion.
     */