~ubuntu-branches/debian/sid/glusterfs/sid

« back to all changes in this revision

Viewing changes to api/src/glfs-resolve.c

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-01-03 12:26:31 UTC
  • mfrom: (1.3.23)
  • Revision ID: package-import@ubuntu.com-20140103122631-juk6hhl6fqkmtvpl
Tags: 3.4.2-1
* New upstream release.
* Overwrite debian-watch-may-check-gpg-signature warning. There is no GPG
  signature available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        }
68
68
        pthread_mutex_lock (&fs->mutex);
69
69
        fs->migration_in_progress = 0;
 
70
        pthread_cond_broadcast (&fs->cond);
70
71
 
71
72
        return ret;
72
73
}
128
129
        }
129
130
        pthread_mutex_lock (&fs->mutex);
130
131
        fs->migration_in_progress = 0;
 
132
        pthread_cond_broadcast (&fs->cond);
131
133
 
132
134
        return newinode;
133
135
}
191
193
}
192
194
 
193
195
 
194
 
void
 
196
int
195
197
glfs_resolve_base (struct glfs *fs, xlator_t *subvol, inode_t *inode,
196
198
                   struct iatt *iatt)
197
199
{
210
212
        ret = syncop_lookup (subvol, &loc, NULL, iatt, NULL, NULL);
211
213
out:
212
214
        loc_wipe (&loc);
 
215
 
 
216
        return ret;
213
217
}
214
218
 
215
219
 
337
341
        } else {
338
342
                inode = inode_ref (subvol->itable->root);
339
343
 
340
 
                glfs_resolve_base (fs, subvol, inode, &ciatt);
 
344
                if (strcmp (path, "/") == 0)
 
345
                        glfs_resolve_base (fs, subvol, inode, &ciatt);
341
346
        }
342
347
 
343
348
        for (component = strtok_r (path, "/", &saveptr);
356
361
                                                   component, as the caller
357
362
                                                   wants proper iatt filled
358
363
                                                */
359
 
                                                (reval || !next_component));
 
364
                                                (reval || (!next_component &&
 
365
                                                iatt)));
360
366
                if (!inode)
361
367
                        break;
362
368
 
662
668
        }
663
669
        pthread_mutex_lock (&fs->mutex);
664
670
        fs->migration_in_progress = 0;
 
671
        pthread_cond_broadcast (&fs->cond);
665
672
 
666
673
        return newfd;
667
674
}
900
907
 
901
908
        return cwd;
902
909
}
 
910
 
 
911
inode_t *
 
912
__glfs_resolve_inode (struct glfs *fs, xlator_t *subvol,
 
913
                    struct glfs_object *object)
 
914
{
 
915
        inode_t *inode = NULL;
 
916
 
 
917
        if (object->inode->table->xl == subvol)
 
918
                return inode_ref (object->inode);
 
919
 
 
920
        inode = __glfs_refresh_inode (fs, fs->active_subvol,
 
921
                                        object->inode);
 
922
        if (!inode)
 
923
                return NULL;
 
924
 
 
925
        if (subvol == fs->active_subvol) {
 
926
                inode_unref (object->inode);
 
927
                object->inode = inode_ref (inode);
 
928
        }
 
929
 
 
930
        return inode;
 
931
}
 
932
 
 
933
inode_t *
 
934
glfs_resolve_inode (struct glfs *fs, xlator_t *subvol,
 
935
                    struct glfs_object *object)
 
936
{
 
937
        inode_t *inode = NULL;
 
938
 
 
939
        glfs_lock (fs);
 
940
        {
 
941
                inode = __glfs_resolve_inode(fs, subvol, object);
 
942
        }
 
943
        glfs_unlock (fs);
 
944
 
 
945
        return inode;
 
946
}
 
947
 
 
948
int
 
949
glfs_create_object (loc_t *loc, struct glfs_object **retobject)
 
950
{
 
951
        struct glfs_object *object = NULL;
 
952
 
 
953
        object = GF_CALLOC (1, sizeof(struct glfs_object),
 
954
                            glfs_mt_glfs_object_t);
 
955
        if (object == NULL) {
 
956
                errno = ENOMEM;
 
957
                return -1;
 
958
        }
 
959
 
 
960
        object->inode = loc->inode;
 
961
        uuid_copy (object->gfid, object->inode->gfid);
 
962
 
 
963
        /* we hold the reference */
 
964
        loc->inode = NULL;
 
965
 
 
966
        *retobject = object;
 
967
 
 
968
        return 0;
 
969
}