aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu_diff.c
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-11-21 09:32:57 -0800
committerBrian Behlendorf <[email protected]>2019-11-21 09:32:57 -0800
commitda92d5cbb38cea3a860b8a6bb8ee21f9129e7d7c (patch)
treecc2d84b481a30b43d4097603e79a55a1975b0b64 /module/zfs/dmu_diff.c
parent67a6c3bc9ff401fa04bc41354c5172b51aaed1c9 (diff)
Add zfs_file_* interface, remove vnodes
Provide a common zfs_file_* interface which can be implemented on all platforms to perform normal file access from either the kernel module or the libzpool library. This allows all non-portable vnode_t usage in the common code to be replaced by the new portable zfs_file_t. The associated vnode and kobj compatibility functions, types, and macros have been removed from the SPL. Moving forward, vnodes should only be used in platform specific code when provided by the native operating system. Reviewed-by: Sean Eric Fagan <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9556
Diffstat (limited to 'module/zfs/dmu_diff.c')
-rw-r--r--module/zfs/dmu_diff.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/module/zfs/dmu_diff.c b/module/zfs/dmu_diff.c
index c40ed57f2..e08cf21ab 100644
--- a/module/zfs/dmu_diff.c
+++ b/module/zfs/dmu_diff.c
@@ -40,33 +40,36 @@
#include <sys/zap.h>
#include <sys/zio_checksum.h>
#include <sys/zfs_znode.h>
+#include <sys/zfs_file.h>
-struct diffarg {
- struct vnode *da_vp; /* file to which we are reporting */
+
+typedef struct dmu_diffarg {
+ zfs_file_t *da_fp; /* file to which we are reporting */
offset_t *da_offp;
int da_err; /* error that stopped diff search */
dmu_diff_record_t da_ddr;
-};
+} dmu_diffarg_t;
-static int
-write_record(struct diffarg *da)
+int
+write_record(dmu_diffarg_t *da)
{
- ssize_t resid; /* have to get resid to get detailed errno */
+ zfs_file_t *fp;
+ ssize_t resid;
if (da->da_ddr.ddr_type == DDR_NONE) {
da->da_err = 0;
return (0);
}
- da->da_err = vn_rdwr(UIO_WRITE, da->da_vp, (caddr_t)&da->da_ddr,
- sizeof (da->da_ddr), 0, UIO_SYSSPACE, FAPPEND,
- RLIM64_INFINITY, CRED(), &resid);
+ fp = da->da_fp;
+ da->da_err = zfs_file_write(fp, (caddr_t)&da->da_ddr,
+ sizeof (da->da_ddr), &resid);
*da->da_offp += sizeof (da->da_ddr);
return (da->da_err);
}
static int
-report_free_dnode_range(struct diffarg *da, uint64_t first, uint64_t last)
+report_free_dnode_range(dmu_diffarg_t *da, uint64_t first, uint64_t last)
{
ASSERT(first <= last);
if (da->da_ddr.ddr_type != DDR_FREE ||
@@ -83,7 +86,7 @@ report_free_dnode_range(struct diffarg *da, uint64_t first, uint64_t last)
}
static int
-report_dnode(struct diffarg *da, uint64_t object, dnode_phys_t *dnp)
+report_dnode(dmu_diffarg_t *da, uint64_t object, dnode_phys_t *dnp)
{
ASSERT(dnp != NULL);
if (dnp->dn_type == DMU_OT_NONE)
@@ -110,7 +113,7 @@ static int
diff_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg)
{
- struct diffarg *da = arg;
+ dmu_diffarg_t *da = arg;
int err = 0;
if (issig(JUSTLOOKING) && issig(FORREAL))
@@ -162,9 +165,9 @@ diff_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
int
dmu_diff(const char *tosnap_name, const char *fromsnap_name,
- struct vnode *vp, offset_t *offp)
+ zfs_file_t *fp, offset_t *offp)
{
- struct diffarg da;
+ dmu_diffarg_t da;
dsl_dataset_t *fromsnap;
dsl_dataset_t *tosnap;
dsl_pool_t *dp;
@@ -205,7 +208,7 @@ dmu_diff(const char *tosnap_name, const char *fromsnap_name,
dsl_dataset_long_hold(tosnap, FTAG);
dsl_pool_rele(dp, FTAG);
- da.da_vp = vp;
+ da.da_fp = fp;
da.da_offp = offp;
da.da_ddr.ddr_type = DDR_NONE;
da.da_ddr.ddr_first = da.da_ddr.ddr_last = 0;