Sat Aug 19 14:22:49 2017 UTC ()
Ask some question about the code in a XXX comment


(maya)
diff -r1.14 -r1.15 src/sys/ufs/lfs/lfs_pages.c

cvs diff -r1.14 -r1.15 src/sys/ufs/lfs/lfs_pages.c (expand / switch to unified diff)

--- src/sys/ufs/lfs/lfs_pages.c 2017/06/10 05:29:36 1.14
+++ src/sys/ufs/lfs/lfs_pages.c 2017/08/19 14:22:49 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_pages.c,v 1.14 2017/06/10 05:29:36 maya Exp $ */ 1/* $NetBSD: lfs_pages.c,v 1.15 2017/08/19 14:22:49 maya Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE. 57 * SUCH DAMAGE.
58 * 58 *
59 * @(#)lfs_vnops.c 8.13 (Berkeley) 6/10/95 59 * @(#)lfs_vnops.c 8.13 (Berkeley) 6/10/95
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.14 2017/06/10 05:29:36 maya Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.15 2017/08/19 14:22:49 maya Exp $");
64 64
65#ifdef _KERNEL_OPT 65#ifdef _KERNEL_OPT
66#include "opt_compat_netbsd.h" 66#include "opt_compat_netbsd.h"
67#include "opt_uvm_page_trkown.h" 67#include "opt_uvm_page_trkown.h"
68#endif 68#endif
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/systm.h> 71#include <sys/systm.h>
72#include <sys/namei.h> 72#include <sys/namei.h>
73#include <sys/resourcevar.h> 73#include <sys/resourcevar.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/file.h> 75#include <sys/file.h>
76#include <sys/stat.h> 76#include <sys/stat.h>
@@ -718,28 +718,31 @@ retry: @@ -718,28 +718,31 @@ retry:
718 DLOG((DLOG_PAGE, "lfs_putpages: dirop inode already locked\n")); 718 DLOG((DLOG_PAGE, "lfs_putpages: dirop inode already locked\n"));
719 } else { 719 } else {
720 DLOG((DLOG_PAGE, "lfs_putpages: dirop inode not locked\n")); 720 DLOG((DLOG_PAGE, "lfs_putpages: dirop inode not locked\n"));
721 } 721 }
722 mutex_exit(vp->v_interlock); 722 mutex_exit(vp->v_interlock);
723 723
724 mutex_enter(&lfs_lock); 724 mutex_enter(&lfs_lock);
725 lfs_flush_fs(fs, sync ? SEGM_SYNC : 0); 725 lfs_flush_fs(fs, sync ? SEGM_SYNC : 0);
726 mutex_exit(&lfs_lock); 726 mutex_exit(&lfs_lock);
727 727
728 mutex_enter(vp->v_interlock); 728 mutex_enter(vp->v_interlock);
729 lfs_writer_leave(fs); 729 lfs_writer_leave(fs);
730 730
731 /* The flush will have cleaned out this vnode as well, 731 /*
732 no need to do more to it. */ 732 * The flush will have cleaned out this vnode as well,
 733 * no need to do more to it.
 734 * XXX then why are we falling through and continuing?
 735 */
733 } 736 }
734 737
735 /* 738 /*
736 * This is it. We are going to write some pages. From here on 739 * This is it. We are going to write some pages. From here on
737 * down it's all just mechanics. 740 * down it's all just mechanics.
738 * 741 *
739 * Don't let genfs_putpages wait; lfs_segunlock will wait for us. 742 * Don't let genfs_putpages wait; lfs_segunlock will wait for us.
740 */ 743 */
741 ap->a_flags &= ~PGO_SYNCIO; 744 ap->a_flags &= ~PGO_SYNCIO;
742 745
743 /* 746 /*
744 * If we've already got the seglock, flush the node and return. 747 * If we've already got the seglock, flush the node and return.
745 * The FIP has already been set up for us by lfs_writefile, 748 * The FIP has already been set up for us by lfs_writefile,