* mark_inode_dirty vs mark_inode_dirty_sync
@ 2005-09-02 9:55 David Sanchez
2005-09-02 12:42 ` Dave Kleikamp
0 siblings, 1 reply; 3+ messages in thread
From: David Sanchez @ 2005-09-02 9:55 UTC (permalink / raw)
To: linux-fsdevel
Hi,
Please, could somebody explain me what the mark_inode_dirty* functions
do and what is the difference between mark_inode_dirty and
mark_inode_dirty_sync ?
Thanks
David SANCHEZ
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mark_inode_dirty vs mark_inode_dirty_sync
2005-09-02 9:55 mark_inode_dirty vs mark_inode_dirty_sync David Sanchez
@ 2005-09-02 12:42 ` Dave Kleikamp
[not found] ` <20050902164649.GW7054@schatzie.adilger.int>
0 siblings, 1 reply; 3+ messages in thread
From: Dave Kleikamp @ 2005-09-02 12:42 UTC (permalink / raw)
To: David Sanchez; +Cc: linux-fsdevel
On Fri, 2005-09-02 at 11:55 +0200, David Sanchez wrote:
> Hi,
> Please, could somebody explain me what the mark_inode_dirty* functions
> do and what is the difference between mark_inode_dirty and
> mark_inode_dirty_sync ?
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.
Shaggy
--
David Kleikamp
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] document mark_inode_dirty & mark_inode_dirty_sync in fs.h
[not found] ` <20050902164649.GW7054@schatzie.adilger.int>
@ 2005-09-02 19:05 ` Dave Kleikamp
0 siblings, 0 replies; 3+ messages in thread
From: Dave Kleikamp @ 2005-09-02 19:05 UTC (permalink / raw)
To: Andreas Dilger; +Cc: linux-kernel, fsdevel
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@austin.ibm.com>
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-02 19:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-02 9:55 mark_inode_dirty vs mark_inode_dirty_sync David Sanchez
2005-09-02 12:42 ` Dave Kleikamp
[not found] ` <20050902164649.GW7054@schatzie.adilger.int>
2005-09-02 19:05 ` [PATCH] document mark_inode_dirty & mark_inode_dirty_sync in fs.h Dave Kleikamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).