svn commit: r335650 - head/sys/ufs/ffs
Warner Losh
imp at FreeBSD.org
Tue Jun 26 00:39:39 UTC 2018
Author: imp
Date: Tue Jun 26 00:39:38 2018
New Revision: 335650
URL: https://svnweb.freebsd.org/changeset/base/335650
Log:
Use buf + strategy rather than bypassing geom_vfs layer
The reference counting that's done in the geom_vfs layer to prevent
delivery of requests to defunct devices only works if all requests go
through that layer. UFS was bypassing that layer for BIO_DELETE requests,
sending them to the geom_consumer directly with g_io_request. Allocate
a buf, fill it in, and call strategy on it instead.
Submitted by: Chuck Silvers
Reviewed by: scottl, imp, kirk
Sponsored by: Netflix
Differential: https://reviews.freebsd.org/D15456
Modified:
head/sys/ufs/ffs/ffs_alloc.c
Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c Mon Jun 25 22:36:25 2018 (r335649)
+++ head/sys/ufs/ffs/ffs_alloc.c Tue Jun 26 00:39:38 2018 (r335650)
@@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
#include <security/audit/audit.h>
#include <geom/geom.h>
+#include <geom/geom_vfs.h>
#include <ufs/ufs/dir.h>
#include <ufs/ufs/extattr.h>
@@ -109,7 +110,7 @@ static ufs2_daddr_t
static void ffs_blkfree_cg(struct ufsmount *, struct fs *,
struct vnode *, ufs2_daddr_t, long, ino_t,
struct workhead *);
-static void ffs_blkfree_trim_completed(struct bio *);
+static void ffs_blkfree_trim_completed(struct buf *);
static void ffs_blkfree_trim_task(void *ctx, int pending __unused);
#ifdef INVARIANTS
static int ffs_checkblk(struct inode *, ufs2_daddr_t, long);
@@ -2280,13 +2281,13 @@ ffs_blkfree_trim_task(ctx, pending)
}
static void
-ffs_blkfree_trim_completed(bip)
- struct bio *bip;
+ffs_blkfree_trim_completed(bp)
+ struct buf *bp;
{
struct ffs_blkfree_trim_params *tp;
- tp = bip->bio_caller2;
- g_destroy_bio(bip);
+ tp = bp->b_fsprivate1;
+ free(bp, M_TEMP);
TASK_INIT(&tp->task, 0, ffs_blkfree_trim_task, tp);
taskqueue_enqueue(tp->ump->um_trim_tq, &tp->task);
}
@@ -2303,7 +2304,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum, vtype, de
struct workhead *dephd;
{
struct mount *mp;
- struct bio *bip;
+ struct buf *bp;
struct ffs_blkfree_trim_params *tp;
/*
@@ -2346,16 +2347,16 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum, vtype, de
} else
tp->pdephd = NULL;
- bip = g_alloc_bio();
- bip->bio_cmd = BIO_DELETE;
- bip->bio_offset = dbtob(fsbtodb(fs, bno));
- bip->bio_done = ffs_blkfree_trim_completed;
- bip->bio_length = size;
- bip->bio_caller2 = tp;
+ bp = malloc(sizeof(*bp), M_TEMP, M_WAITOK | M_ZERO);
+ bp->b_iocmd = BIO_DELETE;
+ bp->b_iooffset = dbtob(fsbtodb(fs, bno));
+ bp->b_iodone = ffs_blkfree_trim_completed;
+ bp->b_bcount = size;
+ bp->b_fsprivate1 = tp;
mp = UFSTOVFS(ump);
vn_start_secondary_write(NULL, &mp, 0);
- g_io_request(bip, (struct g_consumer *)devvp->v_bufobj.bo_private);
+ g_vfs_strategy(ump->um_bo, bp);
}
#ifdef INVARIANTS
More information about the svn-src-all
mailing list