From ab4aed671a88556ae70014b86f547d31bda0c80b Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 11 Feb 2003 12:49:58 +0000 Subject: Use the SI_CANDELETE flag on the dev_t rather than the D_CANFREE flag on the cdevsw to determine ability to handle the BIO_DELETE request. --- sys/fs/specfs/spec_vnops.c | 4 +--- sys/geom/geom_dev.c | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 1b34ac8..f8c8a43 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -562,15 +562,13 @@ spec_freeblks(ap) daddr_t a_length; } */ *ap; { - struct cdevsw *bsw; struct buf *bp; /* * XXX: This assumes that strategy does the deed right away. * XXX: this may not be TRTTD. */ - bsw = devsw(ap->a_vp->v_rdev); - if ((bsw->d_flags & D_CANFREE) == 0) + if ((ap->a_vp->v_rdev->si_flags & SI_CANDELETE) == 0) return (0); bp = geteblk(ap->a_length); bp->b_iocmd = BIO_DELETE; diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 07a1df3..c626f14 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -72,7 +72,7 @@ static struct cdevsw g_dev_cdevsw = { /* maj */ GEOM_MAJOR, /* dump */ nodump, /* psize */ g_dev_psize, - /* flags */ D_DISK | D_CANFREE | D_TRACKCLOSE, + /* flags */ D_DISK | D_TRACKCLOSE, /* kqfilter */ nokqfilter }; @@ -171,6 +171,8 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) mtx_lock(&Giant); dev = make_dev(&g_dev_cdevsw, unit2minor(unit++), UID_ROOT, GID_OPERATOR, 0640, gp->name); + if (pp->flags & G_PF_CANDELETE) + dev->si_flags |= SI_CANDELETE; mtx_unlock(&Giant); g_topology_lock(); -- cgit v1.1