Re: [patch] smarter atime updates

H. Peter Anvin
2001-11-30T22:36:38Z

Followup to: <87n1144mo6.fsf@devron.myhome.or.jp>
By author: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
In newsgroup: linux.dev.kernel
>
> Hi,
>
> Andrew Morton <akpm@zip.com.au> writes:
>
> > mark_inode_dirty() is quite expensive for journalling filesystems,
> > and we're calling it a lot more than we need to.
> >
> > --- linux-2.4.17-pre1/fs/inode.c Mon Nov 26 11:52:07 2001
> > +++ linux-akpm/fs/inode.c Thu Nov 29 21:53:02 2001
> > @@ -1187,6 +1187,8 @@ void __init inode_init(unsigned long mem
> >
> > void update_atime (struct inode *inode)
> > {
> > + if (inode->i_atime == CURRENT_TIME)
> > + return;
> > if ( IS_NOATIME (inode) ) return;
> > if ( IS_NODIRATIME (inode) && S_ISDIR (inode->i_mode) ) return;
> > if ( IS_RDONLY (inode) ) return;
>
> in include/linux/fs.h:
>
> #define UPDATE_ATIME(inode) \
> do { \
> if ((inode)->i_atime != CURRENT_TIME) \
> update_atime (inode); \
> } while (0)
>
> How about this macro? (add likely()?)
>

The only potential issue I can see (with either approach) is that it
seems to break filesystems for which atime has a granularity finer
than 1 s.

-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com>