Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Apr 2014 17:03:44 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264658 - head/sys/fs/nandfs
Message-ID:  <201404181703.s3IH3iEO050373@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Apr 18 17:03:43 2014
New Revision: 264658
URL: http://svnweb.freebsd.org/changeset/base/264658

Log:
  Take out the hack to write -1's to non-NAND. Always do a BIO_DELETE on
  the ranges we want to erase. This is nicer to SSDs that want TRIMs
  anyway.

Modified:
  head/sys/fs/nandfs/nandfs.h
  head/sys/fs/nandfs/nandfs_subr.c
  head/sys/fs/nandfs/nandfs_vfsops.c

Modified: head/sys/fs/nandfs/nandfs.h
==============================================================================
--- head/sys/fs/nandfs/nandfs.h	Fri Apr 18 17:03:35 2014	(r264657)
+++ head/sys/fs/nandfs/nandfs.h	Fri Apr 18 17:03:43 2014	(r264658)
@@ -159,8 +159,6 @@ struct nandfs_device {
 	int			nd_syncer_exit;
 	int			nd_cleaner_exit;
 
-	int			nd_is_nand;
-
 	struct nandfs_fsarea	nd_fsarea[NANDFS_NFSAREAS];
 	int			nd_last_fsarea;
 

Modified: head/sys/fs/nandfs/nandfs_subr.c
==============================================================================
--- head/sys/fs/nandfs/nandfs_subr.c	Fri Apr 18 17:03:35 2014	(r264657)
+++ head/sys/fs/nandfs/nandfs_subr.c	Fri Apr 18 17:03:43 2014	(r264658)
@@ -1065,42 +1065,12 @@ nandfs_buf_check(struct buf *bp, uint32_
 int
 nandfs_erase(struct nandfs_device *fsdev, off_t offset, size_t size)
 {
-	struct buf *bp;
-	int read_size, error, i;
-
 	DPRINTF(BLOCK, ("%s: performing erase at offset %jx size %zx\n",
 	    __func__, offset, size));
 
 	MPASS(size % fsdev->nd_erasesize == 0);
 
-	if (fsdev->nd_is_nand) {
-		error = g_delete_data(fsdev->nd_gconsumer, offset, size);
-		return (error);
-	}
-
-	if (size > MAXBSIZE)
-		read_size = MAXBSIZE;
-	else
-		read_size = size;
-
-	error = 0;
-	for (i = 0; i < size / MAXBSIZE; i++) {
-		error = bread(fsdev->nd_devvp, btodb(offset + i * read_size),
-		    read_size, NOCRED, &bp);
-		if (error) {
-			brelse(bp);
-			return (error);
-		}
-		memset(bp->b_data, 0xff, read_size);
-		error = bwrite(bp);
-		if (error) {
-			nandfs_error("%s: err:%d from bwrite\n",
-			    __func__, error);
-			return (error);
-		}
-	}
-
-	return (error);
+	return (g_delete_data(fsdev->nd_gconsumer, offset, size));
 }
 
 int

Modified: head/sys/fs/nandfs/nandfs_vfsops.c
==============================================================================
--- head/sys/fs/nandfs/nandfs_vfsops.c	Fri Apr 18 17:03:35 2014	(r264657)
+++ head/sys/fs/nandfs/nandfs_vfsops.c	Fri Apr 18 17:03:43 2014	(r264658)
@@ -913,7 +913,6 @@ nandfs_mount_device(struct vnode *devvp,
 			 * We conclude that this is not NAND storage
 			 */
 			nandfsdev->nd_erasesize = NANDFS_DEF_ERASESIZE;
-			nandfsdev->nd_is_nand = 0;
 		} else {
 			DROP_GIANT();
 			g_topology_lock();
@@ -924,11 +923,10 @@ nandfs_mount_device(struct vnode *devvp,
 			free(nandfsdev, M_NANDFSMNT);
 			return (error);
 		}
-	} else {
-		nandfsdev->nd_erasesize = erasesize;
-		nandfsdev->nd_is_nand = 1;
 	}
 
+	nandfsdev->nd_erasesize = erasesize;
+
 	DPRINTF(VOLUMES, ("%s: erasesize %x\n", __func__,
 	    nandfsdev->nd_erasesize));
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404181703.s3IH3iEO050373>