Date: Sun, 27 Aug 2017 17:17:08 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: freebsd-hackers@freebsd.org Subject: Re: [PATCH] O_NOATIME support for open(2) Message-ID: <20170827141708.GV1700@kib.kiev.ua> In-Reply-To: <20170827131806.GB21456@schoggimuss.roe.ch> References: <20170826161827.GA21456@schoggimuss.roe.ch> <20170826175606.GQ1700@kib.kiev.ua> <20170827131806.GB21456@schoggimuss.roe.ch>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 27, 2017 at 03:18:06PM +0200, Daniel Roethlisberger wrote: > 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 > Thank you. > > > 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 mean, do we have some code paths which would cause page-ins to set atime ? If we currently do not have that, fine. My brief reading of the code suggests that we do not, at least for UFS. Somewhat related, if an image file is opened O_EXEC | O_NOATIME, does calling fexecve(2) on the fd prevents atime update with your patch ? It seems to me that the case is not handled. Note that in kernel code, we usually prefer O_XXX spelling for the open flags over the FXXX.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170827141708.GV1700>