aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorDirkjan Bussink <[email protected]>2020-02-25 00:38:23 +0100
committerGitHub <[email protected]>2020-02-24 15:38:22 -0800
commit327000ce04b4243f140a38647dca59683d39b8e7 (patch)
treebcaf39829c2492abe4d6f95dbfba97fbb7df6511 /module
parent92bd4cabd615684d1fa476f56e73e0d9edf9a902 (diff)
Remove zfs_getattr and convoff dead code
The `convoff` function is called only in one code path in `zfs_space`. Each caller of `zfs_space` is called with a `flock64_t` that has `l_whence` set to `SEEK_SET`. This means that `convoff` always results in a no-op as the `bfp` parameter has `l_whence` set to `SEEK_SET` and `int whence` is `SEEK_SET` as well. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]> Closes #10006
Diffstat (limited to 'module')
-rw-r--r--module/os/linux/zfs/zfs_vnops.c266
-rw-r--r--module/zfs/dmu.c1
2 files changed, 0 insertions, 267 deletions
diff --git a/module/os/linux/zfs/zfs_vnops.c b/module/os/linux/zfs/zfs_vnops.c
index ec870957f..4929c97e9 100644
--- a/module/os/linux/zfs/zfs_vnops.c
+++ b/module/os/linux/zfs/zfs_vnops.c
@@ -2451,218 +2451,6 @@ zfs_fsync(znode_t *zp, int syncflag, cred_t *cr)
return (0);
}
-
-/*
- * Get the requested file attributes and place them in the provided
- * vattr structure.
- *
- * IN: ip - inode of file.
- * vap - va_mask identifies requested attributes.
- * If ATTR_XVATTR set, then optional attrs are requested
- * flags - ATTR_NOACLCHECK (CIFS server context)
- * cr - credentials of caller.
- *
- * OUT: vap - attribute values.
- *
- * RETURN: 0 (always succeeds)
- */
-/* ARGSUSED */
-int
-zfs_getattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
-{
- znode_t *zp = ITOZ(ip);
- zfsvfs_t *zfsvfs = ITOZSB(ip);
- int error = 0;
- uint64_t links;
- uint64_t atime[2], mtime[2], ctime[2];
- xvattr_t *xvap = (xvattr_t *)vap; /* vap may be an xvattr_t * */
- xoptattr_t *xoap = NULL;
- boolean_t skipaclchk = (flags & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
- sa_bulk_attr_t bulk[3];
- int count = 0;
-
- ZFS_ENTER(zfsvfs);
- ZFS_VERIFY_ZP(zp);
-
- zfs_fuid_map_ids(zp, cr, &vap->va_uid, &vap->va_gid);
-
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_ATIME(zfsvfs), NULL, &atime, 16);
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16);
- SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16);
-
- if ((error = sa_bulk_lookup(zp->z_sa_hdl, bulk, count)) != 0) {
- ZFS_EXIT(zfsvfs);
- return (error);
- }
-
- /*
- * If ACL is trivial don't bother looking for ACE_READ_ATTRIBUTES.
- * Also, if we are the owner don't bother, since owner should
- * always be allowed to read basic attributes of file.
- */
- if (!(zp->z_pflags & ZFS_ACL_TRIVIAL) &&
- (vap->va_uid != crgetuid(cr))) {
- if ((error = zfs_zaccess(zp, ACE_READ_ATTRIBUTES, 0,
- skipaclchk, cr))) {
- ZFS_EXIT(zfsvfs);
- return (error);
- }
- }
-
- /*
- * Return all attributes. It's cheaper to provide the answer
- * than to determine whether we were asked the question.
- */
-
- mutex_enter(&zp->z_lock);
- vap->va_mode = zp->z_mode;
- vap->va_fsid = ZTOI(zp)->i_sb->s_dev;
- vap->va_nodeid = zp->z_id;
- if ((zp->z_id == zfsvfs->z_root) && zfs_show_ctldir(zp))
- links = ZTOI(zp)->i_nlink + 1;
- else
- links = ZTOI(zp)->i_nlink;
- vap->va_nlink = MIN(links, ZFS_LINK_MAX);
- vap->va_size = i_size_read(ip);
- vap->va_rdev = ip->i_rdev;
-
- /*
- * Add in any requested optional attributes and the create time.
- * Also set the corresponding bits in the returned attribute bitmap.
- */
- if ((xoap = xva_getxoptattr(xvap)) != NULL && zfsvfs->z_use_fuids) {
- if (XVA_ISSET_REQ(xvap, XAT_ARCHIVE)) {
- xoap->xoa_archive =
- ((zp->z_pflags & ZFS_ARCHIVE) != 0);
- XVA_SET_RTN(xvap, XAT_ARCHIVE);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_READONLY)) {
- xoap->xoa_readonly =
- ((zp->z_pflags & ZFS_READONLY) != 0);
- XVA_SET_RTN(xvap, XAT_READONLY);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_SYSTEM)) {
- xoap->xoa_system =
- ((zp->z_pflags & ZFS_SYSTEM) != 0);
- XVA_SET_RTN(xvap, XAT_SYSTEM);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_HIDDEN)) {
- xoap->xoa_hidden =
- ((zp->z_pflags & ZFS_HIDDEN) != 0);
- XVA_SET_RTN(xvap, XAT_HIDDEN);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_NOUNLINK)) {
- xoap->xoa_nounlink =
- ((zp->z_pflags & ZFS_NOUNLINK) != 0);
- XVA_SET_RTN(xvap, XAT_NOUNLINK);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_IMMUTABLE)) {
- xoap->xoa_immutable =
- ((zp->z_pflags & ZFS_IMMUTABLE) != 0);
- XVA_SET_RTN(xvap, XAT_IMMUTABLE);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_APPENDONLY)) {
- xoap->xoa_appendonly =
- ((zp->z_pflags & ZFS_APPENDONLY) != 0);
- XVA_SET_RTN(xvap, XAT_APPENDONLY);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_NODUMP)) {
- xoap->xoa_nodump =
- ((zp->z_pflags & ZFS_NODUMP) != 0);
- XVA_SET_RTN(xvap, XAT_NODUMP);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_OPAQUE)) {
- xoap->xoa_opaque =
- ((zp->z_pflags & ZFS_OPAQUE) != 0);
- XVA_SET_RTN(xvap, XAT_OPAQUE);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_AV_QUARANTINED)) {
- xoap->xoa_av_quarantined =
- ((zp->z_pflags & ZFS_AV_QUARANTINED) != 0);
- XVA_SET_RTN(xvap, XAT_AV_QUARANTINED);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_AV_MODIFIED)) {
- xoap->xoa_av_modified =
- ((zp->z_pflags & ZFS_AV_MODIFIED) != 0);
- XVA_SET_RTN(xvap, XAT_AV_MODIFIED);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_AV_SCANSTAMP) &&
- S_ISREG(ip->i_mode)) {
- zfs_sa_get_scanstamp(zp, xvap);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_CREATETIME)) {
- uint64_t times[2];
-
- (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_CRTIME(zfsvfs),
- times, sizeof (times));
- ZFS_TIME_DECODE(&xoap->xoa_createtime, times);
- XVA_SET_RTN(xvap, XAT_CREATETIME);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_REPARSE)) {
- xoap->xoa_reparse = ((zp->z_pflags & ZFS_REPARSE) != 0);
- XVA_SET_RTN(xvap, XAT_REPARSE);
- }
- if (XVA_ISSET_REQ(xvap, XAT_GEN)) {
- xoap->xoa_generation = ip->i_generation;
- XVA_SET_RTN(xvap, XAT_GEN);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_OFFLINE)) {
- xoap->xoa_offline =
- ((zp->z_pflags & ZFS_OFFLINE) != 0);
- XVA_SET_RTN(xvap, XAT_OFFLINE);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_SPARSE)) {
- xoap->xoa_sparse =
- ((zp->z_pflags & ZFS_SPARSE) != 0);
- XVA_SET_RTN(xvap, XAT_SPARSE);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_PROJINHERIT)) {
- xoap->xoa_projinherit =
- ((zp->z_pflags & ZFS_PROJINHERIT) != 0);
- XVA_SET_RTN(xvap, XAT_PROJINHERIT);
- }
-
- if (XVA_ISSET_REQ(xvap, XAT_PROJID)) {
- xoap->xoa_projid = zp->z_projid;
- XVA_SET_RTN(xvap, XAT_PROJID);
- }
- }
-
- ZFS_TIME_DECODE(&vap->va_atime, atime);
- ZFS_TIME_DECODE(&vap->va_mtime, mtime);
- ZFS_TIME_DECODE(&vap->va_ctime, ctime);
-
- mutex_exit(&zp->z_lock);
-
- sa_object_size(zp->z_sa_hdl, &vap->va_blksize, &vap->va_nblocks);
-
- if (zp->z_blksz == 0) {
- /*
- * Block size hasn't been set; suggest maximal I/O transfers.
- */
- vap->va_blksize = zfsvfs->z_max_blksz;
- }
-
- ZFS_EXIT(zfsvfs);
- return (0);
-}
-
/*
* Get the basic file attributes and place them in the provided kstat
* structure. The inode is assumed to be the authoritative source
@@ -4902,54 +4690,6 @@ zfs_map(struct inode *ip, offset_t off, caddr_t *addrp, size_t len,
}
/*
- * convoff - converts the given data (start, whence) to the
- * given whence.
- */
-int
-convoff(struct inode *ip, flock64_t *lckdat, int whence, offset_t offset)
-{
- vattr_t vap;
- int error;
-
- if ((lckdat->l_whence == SEEK_END) || (whence == SEEK_END)) {
- if ((error = zfs_getattr(ip, &vap, 0, CRED())))
- return (error);
- }
-
- switch (lckdat->l_whence) {
- case SEEK_CUR:
- lckdat->l_start += offset;
- break;
- case SEEK_END:
- lckdat->l_start += vap.va_size;
- /* FALLTHRU */
- case SEEK_SET:
- break;
- default:
- return (SET_ERROR(EINVAL));
- }
-
- if (lckdat->l_start < 0)
- return (SET_ERROR(EINVAL));
-
- switch (whence) {
- case SEEK_CUR:
- lckdat->l_start -= offset;
- break;
- case SEEK_END:
- lckdat->l_start -= vap.va_size;
- /* FALLTHRU */
- case SEEK_SET:
- break;
- default:
- return (SET_ERROR(EINVAL));
- }
-
- lckdat->l_whence = (short)whence;
- return (0);
-}
-
-/*
* Free or allocate space in a file. Currently, this function only
* supports the `F_FREESP' command. However, this command is somewhat
* misnamed, as its functionality includes the ability to allocate as
@@ -4993,11 +4733,6 @@ zfs_space(znode_t *zp, int cmd, flock64_t *bfp, int flag,
return (SET_ERROR(EROFS));
}
- if ((error = convoff(ZTOI(zp), bfp, SEEK_SET, offset))) {
- ZFS_EXIT(zfsvfs);
- return (error);
- }
-
if (bfp->l_len < 0) {
ZFS_EXIT(zfsvfs);
return (SET_ERROR(EINVAL));
@@ -5274,7 +5009,6 @@ EXPORT_SYMBOL(zfs_mkdir);
EXPORT_SYMBOL(zfs_rmdir);
EXPORT_SYMBOL(zfs_readdir);
EXPORT_SYMBOL(zfs_fsync);
-EXPORT_SYMBOL(zfs_getattr);
EXPORT_SYMBOL(zfs_getattr_fast);
EXPORT_SYMBOL(zfs_setattr);
EXPORT_SYMBOL(zfs_rename);
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index ba3c39af0..aa392b177 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -2365,7 +2365,6 @@ dmu_object_info_from_db(dmu_buf_t *db_fake, dmu_object_info_t *doi)
/*
* Faster still when you only care about the size.
- * This is specifically optimized for zfs_getattr().
*/
void
dmu_object_size_from_db(dmu_buf_t *db_fake, uint32_t *blksize,