[PATCH] document mark_inode_dirty & mark_inode_dirty_sync in fs.h

From: Dave Kleikamp
Date: Fri Sep 02 2005 - 14:06:31 EST


On Fri, 2005-09-02 at 10:46 -0600, Andreas Dilger wrote:
> On Sep 02, 2005 07:42 -0500, Dave Kleikamp wrote:
> > They put the inode on the superblock's dirty list and make the inode as
> > dirty in the i_state field. This makes sure that the inode will
> > eventually be written to disk.
> >
> > mark_inode_dirty_sync only sets the I_DIRTY_SYNC flag, which does not
> > imply that any file data was changed. It is called when a minor change
> > is made to an inode, such as a timestamp is changed. Some sync
> > operations will only write the inode if data was written, so can avoid
> > writing the an inode that is only dirtied by I_DIRTY_SYNC.
> >
> > mark_inode_dirty sets I_DIRTY which is I_DIRTY_SYNC | I_DIRTY_DATASYNC |
> > I_DIRTY_PAGES. This indicates that the in-memory inode has changes to
> > the data that have not yet been written to disk.
>
> Dave, could you consider submitting a patch to add the above as comments
> to fs.h for future reference?
>
> Cheers, Andreas

How about this?
=================
Document mark_inode_dirty and mark_inode_dirty_sync in fs.h

Signed-off-by: Dave Kleikamp <shaggy@xxxxxxxxxxxxxx>

diff --git a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1048,7 +1048,7 @@ struct super_operations {
/* Inode state bits. Protected by inode_lock. */
#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */
#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */
-#define I_DIRTY_PAGES 4 /* Data-related inode changes pending */
+#define I_DIRTY_PAGES 4 /* Data changes pending */
#define __I_LOCK 3
#define I_LOCK (1 << __I_LOCK)
#define I_FREEING 16
@@ -1059,11 +1059,19 @@ struct super_operations {
#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)

extern void __mark_inode_dirty(struct inode *, int);
+/*
+ * mark_inode_dirty indicates pending changes to the inode's data.
+ * Puts inode on superblock's dirty list.
+ */
static inline void mark_inode_dirty(struct inode *inode)
{
__mark_inode_dirty(inode, I_DIRTY);
}

+/*
+ * mark_inode_dirty_sync indicates non-data related changes to the inode,
+ * such as a change to a timestamp. Puts inode on superblock's dirty list.
+ */
static inline void mark_inode_dirty_sync(struct inode *inode)
{
__mark_inode_dirty(inode, I_DIRTY_SYNC);

--
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/