Basic compilation of the bulk of zfs_znode.c has been enabled. After
much consideration it was decided to convert the existing vnode based
interfaces to more friendly Linux interfaces. The following commits
will systematically replace update the requiter interfaces. There
are of course pros and cons to this decision.
Pros:
* This simplifies intergration with Linux in the long term. There is
no longer any need to manage vnodes which are a foreign concept to
the Linux VFS.
* Improved long term maintainability.
* Minor performance improvements by removing vnode overhead.
Cons:
* Added work in the short term to modify multiple ZFS interfaces.
* Harder to pull in changes if we ever see any new code from Solaris.
* Mixed Solaris and Linux interfaces in some ZFS code.
int
sa_lookup_uio(sa_handle_t *hdl, sa_attr_type_t attr, uio_t *uio)
{
int
sa_lookup_uio(sa_handle_t *hdl, sa_attr_type_t attr, uio_t *uio)
{
int error;
sa_bulk_attr_t bulk;
int error;
sa_bulk_attr_t bulk;
}
mutex_exit(&hdl->sa_lock);
return (error);
}
mutex_exit(&hdl->sa_lock);
return (error);
-#else
- return ENOSYS;
-#endif /* HAVE_ZPL */
* (such as VFS logic) that will not compile easily in userland.
*/
#ifdef _KERNEL
* (such as VFS logic) that will not compile easily in userland.
*/
#ifdef _KERNEL
/*
* Needed to close a small window in zfs_znode_move() that allows the zfsvfs to
* be freed before it can be safely accessed.
/*
* Needed to close a small window in zfs_znode_move() that allows the zfsvfs to
* be freed before it can be safely accessed.
static kmem_cache_t *znode_cache = NULL;
/*ARGSUSED*/
static kmem_cache_t *znode_cache = NULL;
/*ARGSUSED*/
-static void
-znode_evict_error(dmu_buf_t *dbuf, void *user_ptr)
-{
- /*
- * We should never drop all dbuf refs without first clearing
- * the eviction callback.
- */
- panic("evicting znode %p\n", user_ptr);
-}
-
-/*ARGSUSED*/
static int
zfs_znode_cache_constructor(void *buf, void *arg, int kmflags)
{
static int
zfs_znode_cache_constructor(void *buf, void *arg, int kmflags)
{
/*
* Cleanup vfs & vnode ops
*/
/*
* Cleanup vfs & vnode ops
*/
rw_destroy(&zfsvfs_lock);
}
rw_destroy(&zfsvfs_lock);
}
struct vnodeops *zfs_dvnodeops;
struct vnodeops *zfs_fvnodeops;
struct vnodeops *zfs_symvnodeops;
struct vnodeops *zfs_dvnodeops;
struct vnodeops *zfs_fvnodeops;
struct vnodeops *zfs_symvnodeops;
#define MAXMIN64 0xffffffffUL
#endif
#define MAXMIN64 0xffffffffUL
#endif
/*
* Create special expldev for ZFS private use.
* Can't use standard expldev since it doesn't do
/*
* Create special expldev for ZFS private use.
* Can't use standard expldev since it doesn't do
dmu_object_type_t obj_type, sa_handle_t *hdl)
{
znode_t *zp;
dmu_object_type_t obj_type, sa_handle_t *hdl)
{
znode_t *zp;
vnode_t *vp;
uint64_t mode;
uint64_t parent;
sa_bulk_attr_t bulk[9];
int count = 0;
vnode_t *vp;
uint64_t mode;
uint64_t parent;
sa_bulk_attr_t bulk[9];
int count = 0;
zp = kmem_cache_alloc(znode_cache, KM_SLEEP);
zp = kmem_cache_alloc(znode_cache, KM_SLEEP);
zp->z_seq = 0x7A4653;
zp->z_sync_cnt = 0;
zp->z_seq = 0x7A4653;
zp->z_sync_cnt = 0;
vp = ZTOV(zp);
vn_reinit(vp);
vp = ZTOV(zp);
vn_reinit(vp);
vn_setops(vp, zfs_evnodeops);
break;
}
vn_setops(vp, zfs_evnodeops);
break;
}
mutex_enter(&zfsvfs->z_znodes_lock);
list_insert_tail(&zfsvfs->z_all_znodes, zp);
membar_producer();
mutex_enter(&zfsvfs->z_znodes_lock);
list_insert_tail(&zfsvfs->z_all_znodes, zp);
membar_producer();
void
zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx)
{
void
zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx)
{
xoptattr_t *xoap;
xoap = xva_getxoptattr(xvap);
xoptattr_t *xoap;
xoap = xva_getxoptattr(xvap);
zp->z_pflags, tx);
XVA_SET_RTN(xvap, XAT_SPARSE);
}
zp->z_pflags, tx);
XVA_SET_RTN(xvap, XAT_SPARSE);
}
+#endif /* HAVE_XVATTR */
dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy);
}
dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy);
}
/*
* This is a dummy interface used when pvn_vplist_dirty() should *not*
* be calling back into the fs for a putpage(). E.g.: when truncating
/*
* This is a dummy interface used when pvn_vplist_dirty() should *not*
* be calling back into the fs for a putpage(). E.g.: when truncating
/*
* Increase the file length
/*
* Increase the file length
zfs_trunc(znode_t *zp, uint64_t end)
{
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
zfs_trunc(znode_t *zp, uint64_t end)
{
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
dmu_tx_t *tx;
rl_t *rl;
int error;
dmu_tx_t *tx;
rl_t *rl;
int error;
/*
* Clear any mapped pages in the truncated region. This has to
* happen outside of the transaction to avoid the possibility of
/*
* Clear any mapped pages in the truncated region. This has to
* happen outside of the transaction to avoid the possibility of
B_INVAL | B_TRUNC, NULL);
ASSERT(error == 0);
}
B_INVAL | B_TRUNC, NULL);
ASSERT(error == 0);
}
int
zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
{
int
zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
{
dmu_tx_t *tx;
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
zilog_t *zilog = zfsvfs->z_log;
dmu_tx_t *tx;
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
zilog_t *zilog = zfsvfs->z_log;
/*
* Check for any locks in the region to be freed.
*/
/*
* Check for any locks in the region to be freed.
*/
if (error = chklock(vp, FWRITE, off, length, flag, NULL))
return (error);
}
if (error = chklock(vp, FWRITE, off, length, flag, NULL))
return (error);
}
if (len == 0) {
error = zfs_trunc(zp, off);
if (len == 0) {
error = zfs_trunc(zp, off);
dmu_tx_commit(tx);
return (0);
}
dmu_tx_commit(tx);
return (0);
}
void
zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
void
zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)