0001-TRIM-fixes.patch

Anonymous, 10/21/2012 09:59 PM

Download (4.46 KB)

View differences:

sys/kern/vfs_subr.c
1835 1835
		{ MNT_SUIDDIR,          "suiddir" },
1836 1836
		{ MNT_SOFTDEP,          "soft-updates" },
1837 1837
		{ MNT_IGNORE,           "ignore" },
1838
		{ MNT_TRIM,             "trim" },
1838 1839
		{ 0,			NULL}
1839 1840
	};
1840 1841
	int bwritten;
sys/vfs/ufs/ffs_alloc.c
1627 1627
	struct ffs_blkfree_trim_params *tp;
1628 1628

  
1629 1629
	tp = ctx;
1630
	lwkt_gettoken(&tp->i_devvp->v_mount->mnt_token);
1630 1631
	ffs_blkfree_cg(tp->i_fs, tp->i_devvp, tp->i_dev, tp->i_number,
1631 1632
	    tp->i_din_uid, tp->bno, tp->size);
1633
	lwkt_reltoken(&tp->i_devvp->v_mount->mnt_token);
1632 1634
	kfree(tp, M_TEMP);
1633 1635
}
1634 1636

  
......
1643 1645
	tp = bp->b_bio1.bio_caller_info1.ptr;
1644 1646
	TASK_INIT(&tp->task, 0, ffs_blkfree_trim_task, tp);
1645 1647
	tp = biop->bio_caller_info1.ptr;
1646
	taskqueue_enqueue(taskqueue_swi, &tp->task);
1648
	taskqueue_enqueue(taskqueue_swi_mp, &tp->task);
1647 1649
	biodone(biop);
1648 1650
}
1649 1651

  
......
1658 1660
void
1659 1661
ffs_blkfree(struct inode *ip, ufs_daddr_t bno, long size) 
1660 1662
{
1661
	struct mount *mp = ip->i_devvp->v_mount;
1663
	struct vnode *vn = ip->i_vnode;
1662 1664
	struct ffs_blkfree_trim_params *tp;
1665
	struct mount *mp;
1666

  
1667
	if (vn == NULL) {
1668
		/* coming here through softdep w/ stored vnode's mp */
1669
		mp = ip->i_vmnt;
1670
	}
1671
	else { /* The vnode is still around */
1672
		mp = vn->v_mount;
1673
	}
1663 1674

  
1664 1675
	if (!(mp->mnt_flag & MNT_TRIM)) {
1665 1676
		ffs_blkfree_cg(ip->i_fs, ip->i_devvp,ip->i_dev,ip->i_number,
sys/vfs/ufs/ffs_softdep.c
1740 1740
	freeblks->fb_uid = ip->i_uid;
1741 1741
	freeblks->fb_previousinum = ip->i_number;
1742 1742
	freeblks->fb_devvp = ip->i_devvp;
1743
	freeblks->fb_vmount = ITOV(ip)->v_mount;
1743 1744
	freeblks->fb_fs = fs;
1744 1745
	freeblks->fb_oldsize = ip->i_size;
1745 1746
	freeblks->fb_newsize = length;
......
2130 2131
	ufs_lbn_t baselbns[NIADDR], tmpval;
2131 2132

  
2132 2133
	tip.i_number = freeblks->fb_previousinum;
2134
	tip.i_vnode = NULL;
2135
	tip.i_vmnt = freeblks->fb_vmount;
2133 2136
	tip.i_devvp = freeblks->fb_devvp;
2134 2137
	tip.i_dev = freeblks->fb_devvp->v_rdev;
2135 2138
	tip.i_fs = freeblks->fb_fs;
sys/vfs/ufs/inode.h
92 92
	struct	 ufs_dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
93 93
	u_quad_t i_modrev;	/* Revision level for NFS lease. */
94 94
	struct	 lockf i_lockf;/* Head of byte-level lock list. */
95
	struct	mount	*i_vmnt;/* Vnode's mp: for (soft-dep) blk-free */
95 96
	/*
96 97
	 * Side effects; used during directory lookup.
97 98
	 */
sys/vfs/ufs/softdep.h
401 401
	ino_t	fb_previousinum;	/* inode of previous owner of blocks */
402 402
	struct	vnode *fb_devvp;	/* filesystem device vnode */
403 403
	struct	fs *fb_fs;		/* addr of superblock */
404
	struct  mount *fb_vmount;	/* vnode mp */
404 405
	off_t	fb_oldsize;		/* previous file size */
405 406
	off_t	fb_newsize;		/* new file size */
406 407
	int	fb_chkcnt;		/* used to check cnt of blks released */
407
-