NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47937: mount -o discard,log is broken



The following reply was made to PR kern/47937; it has been noted by GNATS.

From: "Kai-Uwe Eckhardt" <kuehro%gmx.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/47937: mount -o discard,log is broken
Date: Fri, 26 Dec 2014 11:34:42 +0100

 It was neccessary to adjust the patch to some API changes:
 
 --- /usr/src/sys/ufs/ffs/ffs_alloc.c.orig	2014-12-25 21:14:15.000000000 +0100
 +++ /usr/src/sys/ufs/ffs/ffs_alloc.c	2014-12-25 23:42:43.000000000 +0100
 @@ -1564,6 +1564,7 @@
  	cg = dtog(fs, bno);
  	dev = devvp->v_rdev;
  	ump = VFSTOUFS(spec_node_getmountedfs(devvp));
 +	UFS_WAPBL_JLOCK_ASSERT(ump->um_mountp);
  	KASSERT(fs == ump->um_fs);
  	cgblkno = FFS_FSBTODB(fs, cgtod(fs, cg));
  
 @@ -1606,11 +1607,18 @@
  ffs_blkfree_td(struct fs *fs, struct discardopdata *td)
  {
  	long todo;
 +	int err;
 +	struct ufsmount *ump;
 +	
 +	ump = VFSTOUFS(spec_node_getmountedfs(td->devvp));
  
  	while (td->size) {
  		todo = min(td->size,
  		  ffs_lfragtosize(fs, (fs->fs_frag - ffs_fragnum(fs, td->bno))));
 +		err = UFS_WAPBL_BEGIN(ump->um_mountp);
  		ffs_blkfree_cg(fs, td->devvp, td->bno, todo);
 +		if ( err == 0 ) 
 +		    UFS_WAPBL_END(ump->um_mountp);
  		td->bno += ffs_numfrags(fs, todo);
  		td->size -= todo;
  	}
 
 
 After updating the system I did an fsck and changed mount option log to log,discard.
 After reboot I created copies of the releasedir directory with the install iso and
 img files and pressed the power button of my laptop after the first 3 copies:
 
 for a in 1 2 3 4 5; do echo $a; cp -R /usr/releasdir /usr/releasedir$a; done
 
 After reboot to multiuser an fsck -f / found some errors and successfully recovered
 (typed in from a photo):
 
 FREE BLK COUNTS WRONG IN SUPERBLK
 SALVAGE? [yn] y
 
 SUMMARY INFORMATION BAD
 SALVAGE? [yn] y
 
 BLK(S) MISSING IN BIT MAPS
 SALVAGE [yn] y
 
 592952 files, 7329159 used, 45425312 free (10200 frags, 5676889 blocks, 0.0 % fragment
 
 MARK FILE SYSTEM CLEAN? [yn] y
 
 **** FILE SYSTEM MARKED CLEAN ****
 
 **** FILE SYSTEM WAS MODIFIED ***
 
 **** REBOOT NOW ****
 
 After reboot I compared checksums of copies and original files. Everything was
 correct except the last file copied, where only 30 MB of the iso was copied,
 when the system was switched off. That's OK, we cannot expect miracles ;-) 
 
 I will stress the file system by compiling src and many pkgsrc packages.
 


Home | Main Index | Thread Index | Old Index