fs-writeback.c (ea77f7a2e8561012cf100c530170f12351c3b53e) fs-writeback.c (aa38572954ade525817fe88c54faebf85e5a61c0)
1/*
2 * fs/fs-writeback.c
3 *
4 * Copyright (C) 2002, Linus Torvalds.
5 *
6 * Contains all the functions related to writing back and waiting
7 * upon dirty inodes against superblocks, and writing back dirty
8 * pages against inodes. ie: data writeback. Writeout of the

--- 993 unchanged lines hidden (view full) ---

1002 * CAREFUL! We mark it dirty unconditionally, but move it onto the
1003 * dirty list only if it is hashed or if it refers to a blockdev.
1004 * If it was not hashed, it will never be added to the dirty list
1005 * even if it is later hashed, as it will have been marked dirty already.
1006 *
1007 * In short, make sure you hash any inodes _before_ you start marking
1008 * them dirty.
1009 *
1/*
2 * fs/fs-writeback.c
3 *
4 * Copyright (C) 2002, Linus Torvalds.
5 *
6 * Contains all the functions related to writing back and waiting
7 * upon dirty inodes against superblocks, and writing back dirty
8 * pages against inodes. ie: data writeback. Writeout of the

--- 993 unchanged lines hidden (view full) ---

1002 * CAREFUL! We mark it dirty unconditionally, but move it onto the
1003 * dirty list only if it is hashed or if it refers to a blockdev.
1004 * If it was not hashed, it will never be added to the dirty list
1005 * even if it is later hashed, as it will have been marked dirty already.
1006 *
1007 * In short, make sure you hash any inodes _before_ you start marking
1008 * them dirty.
1009 *
1010 * This function *must* be atomic for the I_DIRTY_PAGES case -
1011 * set_page_dirty() is called under spinlock in several places.
1012 *
1013 * Note that for blockdevs, inode->dirtied_when represents the dirtying time of
1014 * the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of
1015 * the kernel-internal blockdev inode represents the dirtying time of the
1016 * blockdev's pages. This is why for I_DIRTY_PAGES we always use
1017 * page->mapping->host, so the page-dirtying time is recorded in the internal
1018 * blockdev inode.
1019 */
1020void __mark_inode_dirty(struct inode *inode, int flags)
1021{
1022 struct super_block *sb = inode->i_sb;
1023 struct backing_dev_info *bdi = NULL;
1024
1025 /*
1026 * Don't do this for I_DIRTY_PAGES - that doesn't actually
1027 * dirty the inode itself
1028 */
1029 if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
1030 if (sb->s_op->dirty_inode)
1010 * Note that for blockdevs, inode->dirtied_when represents the dirtying time of
1011 * the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of
1012 * the kernel-internal blockdev inode represents the dirtying time of the
1013 * blockdev's pages. This is why for I_DIRTY_PAGES we always use
1014 * page->mapping->host, so the page-dirtying time is recorded in the internal
1015 * blockdev inode.
1016 */
1017void __mark_inode_dirty(struct inode *inode, int flags)
1018{
1019 struct super_block *sb = inode->i_sb;
1020 struct backing_dev_info *bdi = NULL;
1021
1022 /*
1023 * Don't do this for I_DIRTY_PAGES - that doesn't actually
1024 * dirty the inode itself
1025 */
1026 if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
1027 if (sb->s_op->dirty_inode)
1031 sb->s_op->dirty_inode(inode);
1028 sb->s_op->dirty_inode(inode, flags);
1032 }
1033
1034 /*
1035 * make sure that changes are seen by all cpus before we test i_state
1036 * -- mikulas
1037 */
1038 smp_mb();
1039

--- 325 unchanged lines hidden ---
1029 }
1030
1031 /*
1032 * make sure that changes are seen by all cpus before we test i_state
1033 * -- mikulas
1034 */
1035 smp_mb();
1036

--- 325 unchanged lines hidden ---