summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-resolve.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2013-12-02 10:47:26 -0500
committerVijay Bellur <vbellur@redhat.com>2013-12-04 03:34:13 -0800
commit1e40a57d1689b4943f67db5e249008d7f0969208 (patch)
tree59ebd4120b5b7ee27822d7f616ab90d825e5547b /api/src/glfs-resolve.c
parent0f02c5125b96da8083a623ed9f455e68ded46b9c (diff)
gfapi: backport handles to 3.4 for nfs-ganeshav3.4.2qa2
nfs-ganesha-2.0 will ship shortly. It depends on the gfapi handle support, which won't otherwise be released until 3.5 sometime in 2014. Change-Id: I104d6fb275bb2c710790340fdc7d998446403026 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/6394 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api/src/glfs-resolve.c')
-rw-r--r--api/src/glfs-resolve.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 9d64883d7e2..4ca2eb6fcf4 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -193,7 +193,7 @@ out:
}
-void
+int
glfs_resolve_base (struct glfs *fs, xlator_t *subvol, inode_t *inode,
struct iatt *iatt)
{
@@ -212,6 +212,8 @@ glfs_resolve_base (struct glfs *fs, xlator_t *subvol, inode_t *inode,
ret = syncop_lookup (subvol, &loc, NULL, iatt, NULL, NULL);
out:
loc_wipe (&loc);
+
+ return ret;
}
@@ -359,7 +361,8 @@ glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
component, as the caller
wants proper iatt filled
*/
- (reval || !next_component));
+ (reval || (!next_component &&
+ iatt)));
if (!inode)
break;
@@ -904,3 +907,63 @@ glfs_cwd_get (struct glfs *fs)
return cwd;
}
+
+inode_t *
+__glfs_resolve_inode (struct glfs *fs, xlator_t *subvol,
+ struct glfs_object *object)
+{
+ inode_t *inode = NULL;
+
+ if (object->inode->table->xl == subvol)
+ return inode_ref (object->inode);
+
+ inode = __glfs_refresh_inode (fs, fs->active_subvol,
+ object->inode);
+ if (!inode)
+ return NULL;
+
+ if (subvol == fs->active_subvol) {
+ inode_unref (object->inode);
+ object->inode = inode_ref (inode);
+ }
+
+ return inode;
+}
+
+inode_t *
+glfs_resolve_inode (struct glfs *fs, xlator_t *subvol,
+ struct glfs_object *object)
+{
+ inode_t *inode = NULL;
+
+ glfs_lock (fs);
+ {
+ inode = __glfs_resolve_inode(fs, subvol, object);
+ }
+ glfs_unlock (fs);
+
+ return inode;
+}
+
+int
+glfs_create_object (loc_t *loc, struct glfs_object **retobject)
+{
+ struct glfs_object *object = NULL;
+
+ object = GF_CALLOC (1, sizeof(struct glfs_object),
+ glfs_mt_glfs_object_t);
+ if (object == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ object->inode = loc->inode;
+ uuid_copy (object->gfid, object->inode->gfid);
+
+ /* we hold the reference */
+ loc->inode = NULL;
+
+ *retobject = object;
+
+ return 0;
+}