CVS commit: src/sys/ufs/lfs

2024-02-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 17 09:08:21 UTC 2024

Modified Files:
src/sys/ufs/lfs: ulfs_inode.h

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/ulfs_inode.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/ulfs_inode.h
diff -u src/sys/ufs/lfs/ulfs_inode.h:1.24 src/sys/ufs/lfs/ulfs_inode.h:1.25
--- src/sys/ufs/lfs/ulfs_inode.h:1.24	Sat Jun 10 05:29:36 2017
+++ src/sys/ufs/lfs/ulfs_inode.h	Sat Feb 17 09:08:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_inode.h,v 1.24 2017/06/10 05:29:36 maya Exp $	*/
+/*	$NetBSD: ulfs_inode.h,v 1.25 2024/02/17 09:08:21 mlelstv Exp $	*/
 /*  from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp  */
 
 /*
@@ -147,7 +147,7 @@ struct ulfs_ufid {
 	uint16_t ufid_len;	/* Length of structure. */
 	uint16_t ufid_pad;	/* Force 32-bit alignment. */
 	uint32_t ufid_ino;	/* File number (ino). XXX should be 64 */
-	int32_t	  ufid_gen;	/* Generation number. */
+	int32_t  ufid_gen;	/* Generation number. */
 };
 /* Filehandle structure for exported LFSes */
 struct lfid {



CVS commit: src/sys/ufs/lfs

2024-02-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 17 09:08:21 UTC 2024

Modified Files:
src/sys/ufs/lfs: ulfs_inode.h

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/ulfs_inode.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/lfs

2023-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 11 14:50:47 UTC 2023

Modified Files:
src/sys/ufs/lfs: lfs_pages.c

Log Message:
lfs: Assert page identity doesn't change.

Forgot what I was debugging when I inserted a relookup in my local
tree months or years ago, but whatever it was, if that solved a
problem, this KDASSERT will make the problem more obvious.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/ufs/lfs/lfs_pages.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_pages.c
diff -u src/sys/ufs/lfs/lfs_pages.c:1.26 src/sys/ufs/lfs/lfs_pages.c:1.27
--- src/sys/ufs/lfs/lfs_pages.c:1.26	Sat Sep  5 16:30:13 2020
+++ src/sys/ufs/lfs/lfs_pages.c	Tue Apr 11 14:50:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_pages.c,v 1.26 2020/09/05 16:30:13 riastradh Exp $	*/
+/*	$NetBSD: lfs_pages.c,v 1.27 2023/04/11 14:50:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2019 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.26 2020/09/05 16:30:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.27 2023/04/11 14:50:47 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -499,6 +499,9 @@ retry:
 			while (pg->flags & PG_BUSY) {
 uvm_pagewait(pg, vp->v_uobj.vmobjlock, "lfsput2");
 rw_enter(vp->v_uobj.vmobjlock, RW_WRITER);
+/* XXX Page can't change identity here? */
+KDASSERT(pg ==
+uvm_pagelookup(&vp->v_uobj, off));
 			}
 			uvm_pagelock(pg);
 			uvm_pageactivate(pg);



CVS commit: src/sys/ufs/lfs

2023-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 11 14:50:47 UTC 2023

Modified Files:
src/sys/ufs/lfs: lfs_pages.c

Log Message:
lfs: Assert page identity doesn't change.

Forgot what I was debugging when I inserted a relookup in my local
tree months or years ago, but whatever it was, if that solved a
problem, this KDASSERT will make the problem more obvious.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/ufs/lfs/lfs_pages.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/lfs

2022-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 24 20:32:44 UTC 2022

Modified Files:
src/sys/ufs/lfs: lfs_accessors.h

Log Message:
lfs: fix lint warning about empty declaration


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/ufs/lfs/lfs_accessors.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_accessors.h
diff -u src/sys/ufs/lfs/lfs_accessors.h:1.50 src/sys/ufs/lfs/lfs_accessors.h:1.51
--- src/sys/ufs/lfs/lfs_accessors.h:1.50	Mon Sep  7 02:28:12 2020
+++ src/sys/ufs/lfs/lfs_accessors.h	Sun Apr 24 20:32:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_accessors.h,v 1.50 2020/09/07 02:28:12 riastradh Exp $	*/
+/*	$NetBSD: lfs_accessors.h,v 1.51 2022/04/24 20:32:44 rillig Exp $	*/
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.25 2016/01/22 23:06:10 dholland Exp  */
@@ -486,24 +486,24 @@ lfs_copy_dinode(STRUCT_LFS *fs,
 		}		\
 	}			\
 
-LFS_DEF_DINO_ACCESSOR(uint16_t, uint16_t, mode);
-LFS_DEF_DINO_ACCESSOR(int16_t, int16_t, nlink);
-LFS_DEF_DINO_ACCESSOR(uint64_t, uint32_t, inumber);
-LFS_DEF_DINO_ACCESSOR(uint64_t, uint64_t, size);
-LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, atime);
-LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, atimensec);
-LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, mtime);
-LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, mtimensec);
-LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, ctime);
-LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, ctimensec);
-LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, flags);
-LFS_DEF_DINO_ACCESSOR(uint64_t, uint32_t, blocks);
-LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, gen);
-LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, uid);
-LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, gid);
+LFS_DEF_DINO_ACCESSOR(uint16_t, uint16_t, mode)
+LFS_DEF_DINO_ACCESSOR(int16_t, int16_t, nlink)
+LFS_DEF_DINO_ACCESSOR(uint64_t, uint32_t, inumber)
+LFS_DEF_DINO_ACCESSOR(uint64_t, uint64_t, size)
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, atime)
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, atimensec)
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, mtime)
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, mtimensec)
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, ctime)
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, ctimensec)
+LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, flags)
+LFS_DEF_DINO_ACCESSOR(uint64_t, uint32_t, blocks)
+LFS_DEF_DINO_ACCESSOR(int32_t, int32_t, gen)
+LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, uid)
+LFS_DEF_DINO_ACCESSOR(uint32_t, uint32_t, gid)
 
 /* XXX this should be done differently (it's a fake field) */
-LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, rdev);
+LFS_DEF_DINO_ACCESSOR(int64_t, int32_t, rdev)
 
 static __inline daddr_t
 lfs_dino_getdb(STRUCT_LFS *fs, union lfs_dinode *dip, unsigned ix)
@@ -747,10 +747,10 @@ lfs_iblock_set(STRUCT_LFS *fs, void *blo
 		}		\
 	}			\
 
-LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, nblocks);
-LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, version);
-LFS_DEF_FI_ACCESSOR(uint64_t, uint32_t, ino);
-LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, lastlength);
+LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, nblocks)
+LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, version)
+LFS_DEF_FI_ACCESSOR(uint64_t, uint32_t, ino)
+LFS_DEF_FI_ACCESSOR(uint32_t, uint32_t, lastlength)
 
 static __inline daddr_t
 lfs_fi_getblock(STRUCT_LFS *fs, FINFO *fip, unsigned idx)
@@ -882,11 +882,11 @@ lfs_ii_setblock(STRUCT_LFS *fs, IINFO *i
 		}		\
 	}			\
 
-LFS_DEF_IF_ACCESSOR(uint32_t, uint32_t, version);
-LFS_DEF_IF_ACCESSOR(int64_t, int32_t, daddr);
-LFS_DEF_IF_ACCESSOR(uint64_t, uint32_t, nextfree);
-LFS_DEF_IF_ACCESSOR(uint64_t, uint32_t, atime_sec);
-LFS_DEF_IF_ACCESSOR(uint32_t, uint32_t, atime_nsec);
+LFS_DEF_IF_ACCESSOR(uint32_t, uint32_t, version)
+LFS_DEF_IF_ACCESSOR(int64_t, int32_t, daddr)
+LFS_DEF_IF_ACCESSOR(uint64_t, uint32_t, nextfree)
+LFS_DEF_IF_ACCESSOR(uint64_t, uint32_t, atime_sec)
+LFS_DEF_IF_ACCESSOR(uint32_t, uint32_t, atime_nsec)
 
 /*
  * Cleaner information structure.  This resides in the ifile and is used
@@ -921,13 +921,13 @@ LFS_DEF_IF_ACCESSOR(uint32_t, uint32_t, 
 		}		\
 	}			\
 
-LFS_DEF_CI_ACCESSOR(uint32_t, uint32_t, clean);
-LFS_DEF_CI_ACCESSOR(uint32_t, uint32_t, dirty);
-LFS_DEF_CI_ACCESSOR(int64_t, int32_t, bfree);
-LFS_DEF_CI_ACCESSOR(int64_t, int32_t, avail);
-LFS_DEF_CI_ACCESSOR(uint64_t, uint32_t, free_head);
-LFS_DEF_CI_ACCESSOR(uint64_t, uint32_t, free_tail);
-LFS_DEF_CI_ACCESSOR(uint32_t, uint32_t, flags);
+LFS_DEF_CI_ACCESSOR(uint32_t, uint32_t, clean)
+LFS_DEF_CI_ACCESSOR(uint32_t, uint32_t, dirty)
+LFS_DEF_CI_ACCESSOR(int64_t, int32_t, bfree)
+LFS_DEF_CI_ACCESSOR(int64_t, int32_t, avail)
+LFS_DEF_CI_ACCESSOR(uint64_t, uint32_t, free_head)
+LFS_DEF_CI_ACCESSOR(uint64_t, uint32_t, free_tail)
+LFS_DEF_CI_ACCESSOR(uint32_t, uint32_t, flags)
 
 static __inline void
 lfs_ci_shiftcleantodirty(STRUCT_LFS *fs, CLEANERINFO *cip, unsigned num)
@@ -1067,17 +1067,17 @@ segsum_finfobase(STRUCT_LFS *

CVS commit: src/sys/ufs/lfs

2022-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 24 20:32:44 UTC 2022

Modified Files:
src/sys/ufs/lfs: lfs_accessors.h

Log Message:
lfs: fix lint warning about empty declaration


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/ufs/lfs/lfs_accessors.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/lfs

2019-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 00:49:12 UTC 2019

Modified Files:
src/sys/ufs/lfs: lfs_vnops.c ulfs_readwrite.c

Log Message:
unifdef -DLFS_READWRITE ulfs_readwrite.c


To generate a diff of this commit:
cvs rdiff -u -r1.323 -r1.324 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/ulfs_readwrite.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_vnops.c
diff -u src/sys/ufs/lfs/lfs_vnops.c:1.323 src/sys/ufs/lfs/lfs_vnops.c:1.324
--- src/sys/ufs/lfs/lfs_vnops.c:1.323	Tue Jan  1 05:06:55 2019
+++ src/sys/ufs/lfs/lfs_vnops.c	Wed Jun 19 20:49:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vnops.c,v 1.323 2019/01/01 10:06:55 hannken Exp $	*/
+/*	$NetBSD: lfs_vnops.c,v 1.324 2019/06/20 00:49:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.323 2019/01/01 10:06:55 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.324 2019/06/20 00:49:11 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -350,9 +350,7 @@ const struct vnodeopv_entry_desc lfs_fif
 const struct vnodeopv_desc lfs_fifoop_opv_desc =
 	{ &lfs_fifoop_p, lfs_fifoop_entries };
 
-#define	LFS_READWRITE
 #include 
-#undef	LFS_READWRITE
 
 /*
  * Allocate a new inode.

Index: src/sys/ufs/lfs/ulfs_readwrite.c
diff -u src/sys/ufs/lfs/ulfs_readwrite.c:1.24 src/sys/ufs/lfs/ulfs_readwrite.c:1.25
--- src/sys/ufs/lfs/ulfs_readwrite.c:1.24	Sat Jun 10 01:29:36 2017
+++ src/sys/ufs/lfs/ulfs_readwrite.c	Wed Jun 19 20:49:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_readwrite.c,v 1.24 2017/06/10 05:29:36 maya Exp $	*/
+/*	$NetBSD: ulfs_readwrite.c,v 1.25 2019/06/20 00:49:11 christos Exp $	*/
 /*  from NetBSD: ufs_readwrite.c,v 1.120 2015/04/12 22:48:38 riastradh Exp  */
 
 /*-
@@ -33,9 +33,8 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.24 2017/06/10 05:29:36 maya Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.25 2019/06/20 00:49:11 christos Exp $");
 
-#ifdef LFS_READWRITE
 #define	FS			struct lfs
 #define	I_FS			i_lfs
 #define	READ			lfs_read
@@ -46,17 +45,6 @@ __KERNEL_RCSID(1, "$NetBSD: ulfs_readwri
 #define	BUFWR			lfs_bufwr
 #define	fs_sb_getbsize(fs)	lfs_sb_getbsize(fs)
 #define	fs_bmask		lfs_bmask
-#else
-#define	FS			struct fs
-#define	I_FS			i_fs
-#define	READ			ffs_read
-#define	READ_S			"ffs_read"
-#define	WRITE			ffs_write
-#define	WRITE_S			"ffs_write"
-#define	BUFRD			ffs_bufrd
-#define	BUFWR			ffs_bufwr
-#define fs_sb_getbsize(fs)	(fs)->fs_bsize
-#endif
 
 static int	ulfs_post_read_update(struct vnode *, int, int);
 static int	ulfs_post_write_update(struct vnode *, struct uio *, int,
@@ -95,20 +83,14 @@ READ(void *v)
 	/* XXX Eliminate me by refusing directory reads from userland.  */
 	if (vp->v_type == VDIR)
 		return BUFRD(vp, uio, ioflag, ap->a_cred);
-#ifdef LFS_READWRITE
 	/* XXX Eliminate me by using ufs_bufio in lfs.  */
 	if (vp->v_type == VREG && ip->i_number == LFS_IFILE_INUM)
 		return BUFRD(vp, uio, ioflag, ap->a_cred);
-#endif
 	if ((u_int64_t)uio->uio_offset > fs->um_maxfilesize)
 		return (EFBIG);
 	if (uio->uio_resid == 0)
 		return (0);
 
-#ifndef LFS_READWRITE
-	if ((ip->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL)) == SF_SNAPSHOT)
-		return ffs_snapshot_read(vp, uio, ioflag);
-#endif /* !LFS_READWRITE */
 
 	if (uio->uio_offset >= ip->i_size)
 		goto out;
@@ -167,9 +149,6 @@ BUFRD(struct vnode *vp, struct uio *uio,
 	if (uio->uio_resid == 0)
 		return 0;
 
-#ifndef LFS_READWRITE
-	KASSERT(!ISSET(ip->i_flags, (SF_SNAPSHOT | SF_SNAPINVAL)));
-#endif
 
 	if (uio->uio_offset >= ip->i_size)
 		goto out;
@@ -283,12 +262,10 @@ WRITE(void *v)
 	if (uio->uio_offset < 0 ||
 	(u_int64_t)uio->uio_offset + uio->uio_resid > fs->um_maxfilesize)
 		return (EFBIG);
-#ifdef LFS_READWRITE
 	/* Disallow writes to the Ifile, even if noschg flag is removed */
 	/* XXX can this go away when the Ifile is no longer in the namespace? */
 	if (vp == fs->lfs_ivnode)
 		return (EPERM);
-#endif
 	if (uio->uio_resid == 0)
 		return (0);
 
@@ -301,11 +278,9 @@ WRITE(void *v)
 
 	KASSERT(vp->v_type == VREG);
 
-#ifdef LFS_READWRITE
 	async = true;
 	lfs_availwait(fs, lfs_btofsb(fs, uio->uio_resid));
 	lfs_check(vp, LFS_UNUSED_LBN, 0);
-#endif /* !LFS_READWRITE */
 
 	preallocoff = round_page(lfs_blkroundup(fs, MAX(osize, uio->uio_offset)));
 	aflag = ioflag & IO_SYNC ? B_SYNC : 0;
@@ -420,18 +395,7 @@ WRITE(void *v)
 		 * XXXUBC simplistic async flushing.
 		 */
 
-#ifndef LFS_READWRITE
-		if (!async && oldoff >> 16 != uio->uio_offset >> 16) {
-			mutex_enter(vp->v_interlock);
-			error = VOP_PUTPAGES(vp, (oldoff >> 16) << 16,
-			(uio->uio_offset >> 16) << 16,
-			PGO_CLEANIT | PGO_LAZY);
-			if (error)
-break;
-		}
-#else
 		__USE(async);
-#endif
 	}
 	if (error == 0 && ioflag & IO_SYNC

CVS commit: src/sys/ufs/lfs

2019-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 00:49:12 UTC 2019

Modified Files:
src/sys/ufs/lfs: lfs_vnops.c ulfs_readwrite.c

Log Message:
unifdef -DLFS_READWRITE ulfs_readwrite.c


To generate a diff of this commit:
cvs rdiff -u -r1.323 -r1.324 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/ulfs_readwrite.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/ufs/lfs

2017-08-04 Thread coypu
> Log Message:
> fix buffer overflow/KASSERT when cookies are supplied
> lfs no longer uses the ffs-style struct direct, use the correct minimum
> size

For kicks, 'found by running COMPAT_LINUX', which does this (so does NFS).

LFS still comes with this warning that is very hard to miss:
WARNING: the log-structured file system is experimental
WARNING: it may cause system crashes and/or corrupt data
root file system type: lfs


Re: CVS commit: src/sys/ufs/lfs

2017-06-15 Thread maya
On Thu, Jun 15, 2017 at 02:37:31PM +, Maya Rashish wrote:
> Module Name:  src
> Committed By: maya
> Date: Thu Jun 15 14:37:31 UTC 2017
> 
> Modified Files:
>   src/sys/ufs/lfs: lfs_segment.c
> 
> Log Message:
> It isn't safe to drain dirops with seglock held, it'll deadlock if there
> are any dirops. drain before grabbing seglock.

It needs more work but is a big improvement.


Re: CVS commit: src/sys/ufs/lfs

2017-03-15 Thread Christos Zoulas
In article <20170316010924.ea492f...@cvs.netbsd.org>,
Maya Rashish  wrote:
>Module Name:   src
>Committed By:  maya
>Date:  Thu Mar 16 01:09:24 UTC 2017
>
>Modified Files:
>   src/sys/ufs/lfs: lfs_inode.c lfs_vnops.c
>
>Log Message:
>actually cast to unsigned long long and use %llu. certainly not use hex (oops)
>suggested by dh

I think using (uintmax_t) and %ju is preferrable since this is the guaranteed
biggest unsigned type.

christos



Re: CVS commit: src/sys/ufs/lfs

2015-07-25 Thread David Holland
On Sat, Jul 25, 2015 at 10:40:35AM +, Martin Husemann wrote:
 > Modified Files:
 >  src/sys/ufs/lfs: lfs_bio.c lfs_debug.c lfs_pages.c lfs_segment.c
 >  lfs_vnops.c
 > 
 > Log Message:
 > Use accessors in DEBUG and DIAGNOSTIC code as well

Woops, sorry...

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/sys/ufs/lfs

2013-07-28 Thread David Holland
On Sun, Jul 28, 2013 at 04:49:03AM +, Paul Goyette wrote:
 > Modified Files:
 >  src/sys/ufs/lfs: ulfs_quota2.c
 > 
 > Log Message:
 > Remove more unused variables to unbreak the build.

 : @@ -870,7 +865,6 @@
 : struct quota2_header *q2h;
 : struct quota2_entry q2e;
 : struct buf *bp;
 : -   struct lfs *fs = ump->um_lfs;
 : const int needswap = ULFS_MPNEEDSWAP(fs);
^^
 : id_t id2;
 
Uhhh

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/sys/ufs/lfs

2010-12-18 Thread David Holland
On Sat, Dec 18, 2010 at 12:01:46AM +, Eduardo Horvath wrote:
 > Modified Files:
 >  src/sys/ufs/lfs: lfs_vnops.c
 > 
 > Log Message:
 > Byebye deadlock.

What lock is supposed to protect ip->i_flags? A quick survey of
related code suggests that it's supposed to be lfs_lock.

...However, it looks as if that and quite a few other uses of
ip->i_flags ought to be ip->i_flag instead. ip->i_flags holds the
chflags() flags; the inode state flags are supposed to be in
ip->i_flag.

It looks as if all uses of IN_PAGING use ip->i_flags, so it's at least
consistent, but it's wrong. There's also one reference to IN_CLEANING
in ip->i_flags, which has no chance of ever working.

Using lfs_lock to protect either of these isn't consistent with the
ufs code though, AFAIK, so I don't think it's really safe
regardless...

(The existence of i_flag and i_flags members in the same structure
seems to date to the ffsv2 import, but it's sort of been this way via
macros since 4.4. Definitely brickworthy.)

-- 
David A. Holland
dholl...@netbsd.org


CVS commit: src/sys/ufs/lfs

2010-03-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  2 19:34:49 UTC 2010

Modified Files:
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
load lfs syscalls in modload


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/ufs/lfs/lfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.285 src/sys/ufs/lfs/lfs_vfsops.c:1.286
--- src/sys/ufs/lfs/lfs_vfsops.c:1.285	Tue Mar  2 19:30:34 2010
+++ src/sys/ufs/lfs/lfs_vfsops.c	Tue Mar  2 19:34:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.285 2010/03/02 19:30:34 pooka Exp $	*/
+/*	$NetBSD: lfs_vfsops.c,v 1.286 2010/03/02 19:34:49 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.285 2010/03/02 19:30:34 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.286 2010/03/02 19:34:49 pooka Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -92,6 +92,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -340,6 +343,14 @@
 #endif
 }
 
+/* old cleaner syscall interface.  see VOP_FCNTL() */
+static const struct syscall_package lfs_syscalls[] = {
+	{ SYS_lfs_bmapv,	0, (sy_call_t *)sys_lfs_bmapv		},
+	{ SYS_lfs_markv,	0, (sy_call_t *)sys_lfs_markv		},
+	{ SYS_lfs_segclean,	0, (sy_call_t *)sys___lfs_segwait50	},
+	{ 0, 0, NULL },
+};
+
 static int
 lfs_modcmd(modcmd_t cmd, void *arg)
 {
@@ -347,15 +358,21 @@
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+		error = syscall_establish(NULL, lfs_syscalls);
+		if (error)
+			return error;
 		error = vfs_attach(&lfs_vfsops);
-		if (error != 0)
+		if (error != 0) {
+			syscall_disestablish(NULL, lfs_syscalls);
 			break;
+		}
 		lfs_sysctl_setup(&lfs_sysctl_log);
 		break;
 	case MODULE_CMD_FINI:
 		error = vfs_detach(&lfs_vfsops);
 		if (error != 0)
 			break;
+		syscall_disestablish(NULL, lfs_syscalls);
 		sysctl_teardown(&lfs_sysctl_log);
 		break;
 	default:



CVS commit: src/sys/ufs/lfs

2010-03-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  2 19:34:49 UTC 2010

Modified Files:
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
load lfs syscalls in modload


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/ufs/lfs/lfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/lfs

2010-03-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  2 19:30:34 UTC 2010

Modified Files:
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
/*
 * XXX: Get extra reference to LFS vfsops.  This prevents unload,
 * but also prevents kernel panic due to text being unloaded
 * from below lfs_writerd.  When lfs_writerd can exit, remove
 * this!!!
 */


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/sys/ufs/lfs/lfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.284 src/sys/ufs/lfs/lfs_vfsops.c:1.285
--- src/sys/ufs/lfs/lfs_vfsops.c:1.284	Thu Feb 18 01:14:00 2010
+++ src/sys/ufs/lfs/lfs_vfsops.c	Tue Mar  2 19:30:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.284 2010/02/18 01:14:00 eeh Exp $	*/
+/*	$NetBSD: lfs_vfsops.c,v 1.285 2010/03/02 19:30:34 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.284 2010/02/18 01:14:00 eeh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.285 2010/03/02 19:30:34 pooka Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -1047,6 +1047,13 @@
 	if (lfs_writer_daemon == 0 && kthread_create(PRI_BIO, 0, NULL,
 	lfs_writerd, NULL, NULL, "lfs_writer") != 0)
 		panic("fork lfs_writer");
+	/*
+	 * XXX: Get extra reference to LFS vfsops.  This prevents unload,
+	 * but also prevents kernel panic due to text being unloaded
+	 * from below lfs_writerd.  When lfs_writerd can exit, remove
+	 * this!!!
+	 */
+	vfs_getopsbyname(MOUNT_LFS);
 
 	printf("WARNING: the log-structured file system is experimental\n"
 	"WARNING: it may cause system crashes and/or corrupt data\n");



CVS commit: src/sys/ufs/lfs

2010-03-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  2 19:30:34 UTC 2010

Modified Files:
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
/*
 * XXX: Get extra reference to LFS vfsops.  This prevents unload,
 * but also prevents kernel panic due to text being unloaded
 * from below lfs_writerd.  When lfs_writerd can exit, remove
 * this!!!
 */


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/sys/ufs/lfs/lfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/lfs

2010-02-17 Thread Eduardo Horvath
Module Name:src
Committed By:   eeh
Date:   Thu Feb 18 01:14:01 UTC 2010

Modified Files:
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
Fix root filesystem support.


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/sys/ufs/lfs/lfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/ufs/lfs

2009-12-07 Thread Antti Kantee
On Mon Dec 07 2009 at 04:12:10 +, Eduardo Horvath wrote:
> Module Name:  src
> Committed By: eeh
> Date: Mon Dec  7 04:12:10 UTC 2009
> 
> Modified Files:
>   src/sys/ufs/lfs: lfs_bio.c lfs_vfsops.c lfs_vnops.c
> 
> Log Message:
> Fix some more hangs and deadlocks.

How can replacing reference counting by adjusting reclaim order fix
anything?

> @@ -318,11 +318,9 @@
>* vref vnodes here so that cleaner doesn't try to reuse them.
>* (see XXX comment in lfs_reserveavail)
>*/
> - mutex_enter(&vp->v_interlock);
> - lfs_vref(vp);
> + VHOLD(vp);
>   if (vp2 != NULL) {
> - mutex_enter(&vp2->v_interlock);
> - lfs_vref(vp2);
> + VHOLD(vp2);
>   }
>  
>   error = lfs_reserveavail(fs, vp, vp2, fsb);
> @@ -338,9 +336,9 @@
>   lfs_reserveavail(fs, vp, vp2, -fsb);
>  
>  done:
> - lfs_vunref(vp);
> + HOLDRELE(vp);
>   if (vp2 != NULL) {
> - lfs_vunref(vp2);
> + HOLDRELE(vp2);
>   }
>  
>   return error;

Postponing sync flushing doesn't smell like it preserves the correct
semantics.  Can you explain why it works in a bit more detail than in
the commit message?  It would be good to explain it in the comments also
so that someone trying to later read the code doesn't have to go "huh??".

> Index: src/sys/ufs/lfs/lfs_vfsops.c
> diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.280 src/sys/ufs/lfs/lfs_vfsops.c:1.281
> --- src/sys/ufs/lfs/lfs_vfsops.c:1.280Tue Nov 17 17:08:57 2009
> +++ src/sys/ufs/lfs/lfs_vfsops.c  Mon Dec  7 04:12:10 2009
> @@ -1,4 +1,4 @@
> -/*   $NetBSD: lfs_vfsops.c,v 1.280 2009/11/17 17:08:57 pooka Exp $   */
> +/*   $NetBSD: lfs_vfsops.c,v 1.281 2009/12/07 04:12:10 eeh Exp $ */
>  
>  /*-
>   * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
> @@ -61,7 +61,7 @@
>   */
>  
>  #include 
> -__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.280 2009/11/17 17:08:57 pooka 
> Exp $");
> +__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.281 2009/12/07 04:12:10 eeh Exp 
> $");
>  
>  #if defined(_KERNEL_OPT)
>  #include "opt_lfs.h"
> @@ -1549,6 +1549,7 @@
>   vaddr_t kva;
>   off_t eof, offset, startoffset = 0;
>   size_t bytes, iobytes, skipbytes;
> + bool async = (flags & PGO_SYNCIO) == 0;
>   daddr_t lbn, blkno;
>   struct vm_page *pg;
>   struct buf *mbp, *bp;
> @@ -1778,6 +1779,14 @@
>   UVMHIST_LOG(ubchist, "skipbytes %d", skipbytes, 0,0,0);
>   }
>   UVMHIST_LOG(ubchist, "returning 0", 0,0,0,0);
> +
> + if (!async) {
> + /* Start a segment write. */
> + UVMHIST_LOG(ubchist, "flushing", 0,0,0,0);
> + mutex_enter(&lfs_lock);
> + lfs_flush(fs, 0, 1);
> + mutex_exit(&lfs_lock);
> + }
>   return (0);
>  
>  tryagain:
> 
> Index: src/sys/ufs/lfs/lfs_vnops.c
> diff -u src/sys/ufs/lfs/lfs_vnops.c:1.225 src/sys/ufs/lfs/lfs_vnops.c:1.226
> --- src/sys/ufs/lfs/lfs_vnops.c:1.225 Tue Nov 17 22:49:24 2009
> +++ src/sys/ufs/lfs/lfs_vnops.c   Mon Dec  7 04:12:10 2009
> @@ -1,4 +1,4 @@
> -/*   $NetBSD: lfs_vnops.c,v 1.225 2009/11/17 22:49:24 eeh Exp $  */
> +/*   $NetBSD: lfs_vnops.c,v 1.226 2009/12/07 04:12:10 eeh Exp $  */
>  
>  /*-
>   * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
> @@ -60,7 +60,7 @@
>   */
>  
>  #include 
> -__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.225 2009/11/17 22:49:24 eeh Exp 
> $");
> +__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.226 2009/12/07 04:12:10 eeh Exp 
> $");
>  
>  #ifdef _KERNEL_OPT
>  #include "opt_compat_netbsd.h"
> @@ -1768,7 +1768,8 @@
>   if (pg == NULL)
>   return;
>  
> - while (pg->flags & PG_BUSY) {
> + while (pg->flags & PG_BUSY &&
> + pg->uobject == &vp->v_uobj) {
>   mutex_exit(&vp->v_interlock);
>   if (sp->cbpp - sp->bpp > 1) {
>   /* Write gathered pages */
> @@ -2157,7 +2158,7 @@
>*/
>   ip->i_lfs_iflags |= LFSI_NO_GOP_WRITE;
>   r = genfs_do_putpages(vp, startoffset, endoffset,
> -ap->a_flags, &busypg);
> +ap->a_flags & ~PGO_SYNCIO, &busypg);
>   ip->i_lfs_iflags &= ~LFSI_NO_GOP_WRITE;
>   if (r != EDEADLK)
>   return r;
> 



Re: CVS commit: src/sys/ufs/lfs

2009-10-29 Thread Christos Zoulas
In article <20091030002209.gh1...@irregular-apocalypse.k.bsd.de>,
Christoph Badura   wrote:
>On Thu, Oct 29, 2009 at 01:10:32PM -0400, Christos Zoulas wrote:
>> Modified Files:
>>  src/sys/ufs/lfs: lfs.h lfs_vnops.c
>> Log Message:
>> PR/42246: NAKAJIMA Yoshihiro: provide COMPAT_50 for LFS
>
>Is this pull-up fodder?

No, 5.0 does not need COMPAT_50.

christos



Re: CVS commit: src/sys/ufs/lfs

2009-10-29 Thread Christoph Badura
On Thu, Oct 29, 2009 at 01:10:32PM -0400, Christos Zoulas wrote:
> Modified Files:
>   src/sys/ufs/lfs: lfs.h lfs_vnops.c
> Log Message:
> PR/42246: NAKAJIMA Yoshihiro: provide COMPAT_50 for LFS

Is this pull-up fodder?

--chris