Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Aug 2017 15:18:06 +0200
From:      Daniel Roethlisberger <daniel@roe.ch>
To:        freebsd-hackers@freebsd.org
Subject:   Re: [PATCH] O_NOATIME support for open(2)
Message-ID:  <20170827131806.GB21456@schoggimuss.roe.ch>
In-Reply-To: <20170826175606.GQ1700@kib.kiev.ua>
References:  <20170826161827.GA21456@schoggimuss.roe.ch> <20170826175606.GQ1700@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Konstantin Belousov <kostikbel@gmail.com> 2017-08-26:
> On Sat, Aug 26, 2017 at 06:18:27PM +0200, Daniel Roethlisberger wrote:
> > I'm trying to implement O_NOATIME support for open(2) in order to
> > provide a more elegant way for backup/archiving software to
> > prevent atime clobbering.  Except for a 2008 thread on this list
> > I did not find any material; not sure if anybody is interested in
> > this or if there are reasons why this was never implemented.
> Please point out the thread, e.g. by providing a link to the first
> message in the thread in mailman archive.

https://lists.freebsd.org/pipermail/freebsd-hackers/2008-October/thread.html#26531
https://lists.freebsd.org/pipermail/freebsd-hackers/2008-October/026531.html

> > The attached patch against 11.1 implements O_NOATIME support for
> > open(2); it prevents read(2) and mmap(2) from clobbering atime if
> > the file descriptor was opened with O_NOATIME.  O_NOATIME is only
> > permitted for root and the owner of the file.  Currently it is
> > only implemented for ufs/ffs.  It seems to work for me but has
> > not been extensively tested.
> What would happen when additional page-in occurs on the mmaped area ?

With mmap, the vnode is marked for atime update at the time of
calling mmap (unless O_NOATIME is set on the fd).  I do not see
how the patch would impact page-ins in any way.  Can you
elaborate?

> > I am interested in feedback from people who know their way around
> > I/O and VFS code before I extend this to other file systems, make
> > O_NOATIME tunable by fcntl(2), wire it to the Linux compat layer
> > and write docs.  Does the implementation look sane?  Did I miss
> > something important?
> > 
> > Specifically, is there a better way to pass O_NOATIME into
> > vm_mmap_vnode other than adding an additional boolean_t argument?
> > I did not use an additional mmap flag because that would have
> > required additional logic to prevent userland from passing the
> > flag to the mmap syscall.
> If you need two booleans to the function, consider substituting the
> arguments with the single u_int flags, and define two flags, one for
> the writecounted, one for noatime.

Thanks for the feedback, I appreciate it.

Daniel

-- 
Daniel Roethlisberger
http://daniel.roe.ch/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170827131806.GB21456>