On Fri, Nov 13, 2015 at 3:06 PM, Ted Unangst <[email protected]> wrote:
> Chris Cappuccio wrote:
>> Nick Holland [[email protected]] wrote:
>> >
>> > (noatime is a huge performance gain. atime is a feature looking for a
>> > need, I suspect).
>>
>> Someone had a relatime patch. Where did that go???!!
>
> I think that's the default now, thanks to guenther.
No, I only merged the "don't update device node timestamps until
ufs_reclaim()" fix from FreeBSD.
The uncommitted change I've been playing with is below. The first
chunk forces out all lazy inode changes when the filesystem is
unmounted or remounted read-only. The second chunk makes all "only
atime" updates lazy, so they'll only be written if there's some other
inode change to make or when triggered by the change in the first
chunk.
Looking at this again, I think the second chunk needs a
!DOINGSOFTDEP(vp) like the 'if' before it, but I haven't actually
tested that...
Philip
--- ffs/ffs_vfsops.c 14 Mar 2015 03:38:52 -0000 1.149
+++ ffs/ffs_vfsops.c 7 Nov 2015 16:24:51 -0000
@@ -1120,11 +1120,23 @@ ffs_sync_vnode(struct vnode *vp, void *a
struct inode *ip;
int error;
+ if (vp->v_type == VNON)
+ return (0);
+
ip = VTOI(vp);
- if (vp->v_type == VNON ||
- ((ip->i_flag &
+
+ /*
+ * If unmounting or converting rw to ro, then stop deferring
+ * timestamp writes.
+ */
+ if (fsa->waitfor == MNT_WAIT && (ip->i_flag & IN_LAZYMOD)) {
+ ip->i_flag |= IN_MODIFIED;
+ UFS_UPDATE(ip, 1);
+ }
+
+ if ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
- LIST_EMPTY(&vp->v_dirtyblkhd)) ) {
+ LIST_EMPTY(&vp->v_dirtyblkhd)) {
return (0);
}
Index: ufs/ufs_vnops.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.122
diff -u -p -r1.122 ufs_vnops.c
--- ufs/ufs_vnops.c 23 Sep 2015 15:37:26 -0000 1.122
+++ ufs/ufs_vnops.c 7 Nov 2015 16:24:51 -0000
@@ -133,6 +133,10 @@ ufs_itimes(struct vnode *vp)
if ((vp->v_type == VBLK || vp->v_type == VCHR) && !DOINGSOFTDEP(vp))
ip->i_flag |= IN_LAZYMOD;
+#if 1
+ else if ((ip->i_flag & (IN_UPDATE | IN_CHANGE)) == 0)
+ ip->i_flag |= IN_LAZYMOD; /* just atime */
+#endif
else
ip->i_flag |= IN_MODIFIED;