Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Teach zfs bdevsw ...
details: https://anonhg.NetBSD.org/src/rev/712c0e0464af
branches: trunk
changeset: 969696:712c0e0464af
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Feb 28 03:52:26 2020 +0000
description:
Teach zfs bdevsw to do b_psize.
This is needed, among other things, to swap on zvols.
Attempting to swap on zvols currently deadlocks but that's a separate
issue that needs to be fixed too!
diffstat:
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c | 25 +++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diffs (42 lines):
diff -r b32726a50131 -r 712c0e0464af external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 27 23:15:34 2020 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c Fri Feb 28 03:52:26 2020 +0000
@@ -7062,6 +7062,29 @@
(void) zvol_strategy(bp);
}
+static int
+nb_zvol_psize(dev_t dev)
+{
+ minor_t minor = getminor(dev);
+ off_t nbytes;
+ unsigned bytespersector;
+
+ if (minor == 0) /* /dev/zfs */
+ return -1;
+
+ if (zvol_ioctl(dev, DIOCGMEDIASIZE, (intptr_t)&nbytes, 0,
+ NOCRED, NULL))
+ return -1;
+ if (zvol_ioctl(dev, DIOCGSECTORSIZE, (intptr_t)&bytespersector, 0,
+ NOCRED, NULL))
+ return -1;
+ if (bytespersector == 0) /* paranoia */
+ return -1;
+ if (nbytes/bytespersector > INT_MAX) /* paranoia */
+ return -1;
+ return nbytes/bytespersector;
+}
+
static const struct fileops zfs_fileops = {
.fo_name = "zfs",
.fo_read = fbadop_read,
@@ -7081,7 +7104,7 @@
.d_strategy = nb_zvol_strategy,
.d_ioctl = nb_zfsdev_ioctl,
.d_dump = nodump,
- .d_psize = nosize,
+ .d_psize = nb_zvol_psize,
.d_flag = D_DISK | D_MPSAFE
};
Home |
Main Index |
Thread Index |
Old Index