From owner-svn-src-head@FreeBSD.ORG Fri Apr 18 17:03:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 181B39F7; Fri, 18 Apr 2014 17:03:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E977E16AF; Fri, 18 Apr 2014 17:03:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3IH3iBv050376; Fri, 18 Apr 2014 17:03:44 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3IH3iEO050373; Fri, 18 Apr 2014 17:03:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201404181703.s3IH3iEO050373@svn.freebsd.org> From: Warner Losh Date: Fri, 18 Apr 2014 17:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264658 - head/sys/fs/nandfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2014 17:03:45 -0000 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));