* [PATCH 1/3] update timestamp in xfs_ialloc manually
@ 2008-07-26 6:33 Christoph Hellwig
2008-07-26 9:07 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2008-07-26 6:33 UTC (permalink / raw)
To: xfs
In xfs_ialloc we just want to set all timestamps to the current time.
We don't need to mark the inode dirty like xfs_ichgtime does, and we
don't need nor want the opimizations in xfs_ichgtime that I will
introduce in the next patch.
So just opencode the timestamp update in xfs_ialloc, and remove the new
unused XFS_ICHGTIME_ACC case in xfs_ichgtime.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_iops.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_iops.c 2008-07-23 23:29:42.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_iops.c 2008-07-23 23:29:59.000000000 +0200
@@ -89,12 +89,6 @@ xfs_mark_inode_dirty_sync(
* Change the requested timestamp in the given inode.
* We don't lock across timestamp updates, and we don't log them but
* we do record the fact that there is dirty information in core.
- *
- * NOTE -- callers MUST combine XFS_ICHGTIME_MOD or XFS_ICHGTIME_CHG
- * with XFS_ICHGTIME_ACC to be sure that access time
- * update will take. Calling first with XFS_ICHGTIME_ACC
- * and then XFS_ICHGTIME_MOD may fail to modify the access
- * timestamp if the filesystem is mounted noacctm.
*/
void
xfs_ichgtime(
@@ -110,11 +104,6 @@ xfs_ichgtime(
ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
}
- if (flags & XFS_ICHGTIME_ACC) {
- inode->i_atime = tv;
- ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec;
- ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec;
- }
if (flags & XFS_ICHGTIME_CHG) {
inode->i_ctime = tv;
ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec;
@@ -150,12 +139,6 @@ xfs_ichgtime_fast(
timespec_t *tvp;
/*
- * Atime updates for read() & friends are handled lazily now, and
- * explicit updates must go through xfs_ichgtime()
- */
- ASSERT((flags & XFS_ICHGTIME_ACC) == 0);
-
- /*
* We're not supposed to change timestamps in readonly-mounted
* filesystems. Throw it away if anyone asks us.
*/
Index: linux-2.6-xfs/fs/xfs/xfs_inode.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_inode.c 2008-07-23 23:27:26.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_inode.c 2008-07-23 23:29:07.000000000 +0200
@@ -1049,6 +1049,7 @@ xfs_ialloc(
xfs_inode_t *ip;
uint flags;
int error;
+ timespec_t tv;
/*
* Call the space management code to pick
@@ -1129,7 +1130,13 @@ xfs_ialloc(
ip->i_size = 0;
ip->i_d.di_nextents = 0;
ASSERT(ip->i_d.di_nblocks == 0);
- xfs_ichgtime(ip, XFS_ICHGTIME_CHG|XFS_ICHGTIME_ACC|XFS_ICHGTIME_MOD);
+
+ nanotime(&tv);
+ ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
+ ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
+ ip->i_d.di_atime = ip->i_d.di_mtime;
+ ip->i_d.di_ctime = ip->i_d.di_mtime;
+
/*
* di_gen will have been taken care of in xfs_iread.
*/
Index: linux-2.6-xfs/fs/xfs/xfs_inode.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_inode.h 2008-07-23 23:30:06.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_inode.h 2008-07-23 23:30:16.000000000 +0200
@@ -87,8 +87,7 @@ typedef struct xfs_ifork {
* Flags for xfs_ichgtime().
*/
#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
-#define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */
-#define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */
+#define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */
/*
* Per-fork incore inode flags.
Index: linux-2.6-xfs/fs/xfs/xfs_vnodeops.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_vnodeops.c 2008-07-23 23:29:21.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_vnodeops.c 2008-07-23 23:29:37.000000000 +0200
@@ -513,7 +513,6 @@ xfs_setattr(
ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
ip->i_update_core = 1;
- timeflags &= ~XFS_ICHGTIME_ACC;
}
if (mask & ATTR_MTIME) {
inode->i_mtime = iattr->ia_mtime;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] update timestamp in xfs_ialloc manually
2008-07-26 6:33 [PATCH 1/3] update timestamp in xfs_ialloc manually Christoph Hellwig
@ 2008-07-26 9:07 ` Dave Chinner
2008-07-26 9:14 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2008-07-26 9:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Sat, Jul 26, 2008 at 08:33:31AM +0200, Christoph Hellwig wrote:
> In xfs_ialloc we just want to set all timestamps to the current time.
> We don't need to mark the inode dirty like xfs_ichgtime does, and we
> don't need nor want the opimizations in xfs_ichgtime that I will
> introduce in the next patch.
Looks sane, and solves an issue with code I'm working on, too.
FWIW, the conditional check against I_NEW before marking the
indo dirty can be removed as well, as this was call that required
avoiding avoiding it.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] update timestamp in xfs_ialloc manually
2008-07-26 9:07 ` Dave Chinner
@ 2008-07-26 9:14 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2008-07-26 9:14 UTC (permalink / raw)
To: Christoph Hellwig, xfs
On Sat, Jul 26, 2008 at 07:07:25PM +1000, Dave Chinner wrote:
> On Sat, Jul 26, 2008 at 08:33:31AM +0200, Christoph Hellwig wrote:
> > In xfs_ialloc we just want to set all timestamps to the current time.
> > We don't need to mark the inode dirty like xfs_ichgtime does, and we
> > don't need nor want the opimizations in xfs_ichgtime that I will
> > introduce in the next patch.
>
> Looks sane, and solves an issue with code I'm working on, too.
>
> FWIW, the conditional check against I_NEW before marking the
> indo dirty can be removed as well, as this was call that required
> avoiding avoiding it.
Yeah. Will update and retest the patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-26 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-26 6:33 [PATCH 1/3] update timestamp in xfs_ialloc manually Christoph Hellwig
2008-07-26 9:07 ` Dave Chinner
2008-07-26 9:14 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox