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.
This commit is contained in:
imp 2014-04-18 17:03:43 +00:00
parent dc1d630338
commit af1f03cbf4
3 changed files with 3 additions and 37 deletions

View File

@ -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;

View File

@ -1065,42 +1065,12 @@ nandfs_buf_check(struct buf *bp, uint32_t bits)
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

View File

@ -913,7 +913,6 @@ nandfs_mount_device(struct vnode *devvp, struct mount *mp,
* 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, struct mount *mp,
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));