diff options
author | phk <phk@FreeBSD.org> | 1999-07-20 09:47:55 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-07-20 09:47:55 +0000 |
commit | cacc73aa1890c8a258a383716e0c90da798acd4e (patch) | |
tree | 895deb1c3a5fdc3b63cee3173606b1811c3149f5 /sys/dev | |
parent | cf4a7fab742bfd88596615a4e608783600af67b5 (diff) | |
download | FreeBSD-src-cacc73aa1890c8a258a383716e0c90da798acd4e.zip FreeBSD-src-cacc73aa1890c8a258a383716e0c90da798acd4e.tar.gz |
Now a dev_t is a pointer to struct specinfo which is shared by all specdev
vnodes referencing this device.
Details:
cdevsw->d_parms has been removed, the specinfo is available
now (== dev_t) and the driver should modify it directly
when applicable, and the only driver doing so, does so:
vn.c. I am not sure the logic in checking for "<" was right
before, and it looks even less so now.
An intial pool of 50 struct specinfo are depleted during
early boot, after that malloc had better work. It is
likely that fewer than 50 would do.
Hashing is done from udev_t to dev_t with a prime number
remainder hash, experiments show no better hash available
for decent cost (MD5 is only marginally better) The prime
number used should not be close to a power of two, we use
83 for now.
Add new checkalias2() to get around the loss of info from
dev2udev() in bdevvp();
The aliased vnodes are hung on a list straight of the dev_t,
and speclisth[SPECSZ] is unused. The sharing of struct
specinfo means that the v_specnext moves into the vnode
which grows by 4 bytes.
Don't use a VBLK dev_t which doesn't make sense in MFS, now
we hang a dummy cdevsw on B/Cmaj 253 so that things look sane.
Storage overhead from all of this is O(50k).
Bump __FreeBSD_version to 400009
The next step will add the stuff needed so device-drivers can start to
hang things from struct specinfo
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/vn/vn.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c index 3288038..06bf27f 100644 --- a/sys/dev/vn/vn.c +++ b/sys/dev/vn/vn.c @@ -38,7 +38,7 @@ * from: Utah Hdr: vn.c 1.13 94/04/02 * * from: @(#)vn.c 8.6 (Berkeley) 4/1/94 - * $Id: vn.c,v 1.79 1999/05/11 19:54:02 phk Exp $ + * $Id: vn.c,v 1.80 1999/05/30 16:51:55 phk Exp $ */ /* @@ -108,7 +108,6 @@ static d_close_t vnclose; static d_dump_t vndump; static d_psize_t vnsize; static d_strategy_t vnstrategy; -static d_parms_t vnparms; #define CDEV_MAJOR 43 #define BDEV_MAJOR 15 @@ -133,7 +132,7 @@ static struct cdevsw vn_cdevsw = { /* mmap */ nommap, /* strategy */ vnstrategy, /* name */ "vn", - /* parms */ vnparms, + /* parms */ noparms, /* maj */ CDEV_MAJOR, /* dump */ vndump, /* psize */ vnsize, @@ -516,6 +515,10 @@ vniocattach_file(vn, vio, dev, flag, p) (void) vn_close(nd.ni_vp, FREAD|FWRITE, p->p_ucred, p); return(error); } + if (dev->si_bsize_phys < vn->sc_secsize) + dev->si_bsize_phys = vn->sc_secsize; + if (dev->si_bsize_best < vn->sc_secsize) + dev->si_bsize_best = vn->sc_secsize; vn->sc_flags |= VNF_INITED; IFOPT(vn, VN_LABELS) { /* @@ -686,44 +689,6 @@ vnsize(dev_t dev) return(vn->sc_size); } -/* - * vnparms() - return requested device block info - * - * This is typically called by specfs with DBLK_MIN to get - * the minimum read/write block size. If the device does not - * exist or has not been configured, 0 is returned. - */ - -static int -vnparms(dev_t dev, struct specinfo *sinfo, int ctl) -{ - int unit = vnunit(dev); - int r = -1; - struct vn_softc *vn; - - if (unit < 0 || unit >= NVN) - return(r); - if ((vn = vn_softc[unit]) == NULL || (vn->sc_flags & VNF_INITED) == 0) - return(r); - - switch(ctl) { - case DPARM_GET: - /* - * Retrieve disk parameters. The system has already set - * the defaults, we simply override them as necessary. - */ - r = 0; - if (sinfo->si_bsize_phys < vn->sc_secsize) - sinfo->si_bsize_phys = vn->sc_secsize; - if (sinfo->si_bsize_best < vn->sc_secsize) - sinfo->si_bsize_best = vn->sc_secsize; - break; - default: - break; - } - return(r); -} - static int vndump(dev_t dev) { |