• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/fs/ceph/

Lines Matching refs:realm

25  * of the files contained by each realm share the same set of
26 * snapshots. An individual realm's snap set contains snapshots
27 * explicitly created on that realm, as well as any snaps in its
34 * realm relationship, and for each realm has an explicit list of snaps
38 * with an open cap in the system. (The needed snap realm information is
40 * version number is used to ensure that as realm parameters change (new
41 * snapshot, new parent, etc.) the client's realm hierarchy is updated.
43 * The realm hierarchy drives the generation of a 'snap context' for each
44 * realm, which simply lists the resulting set of snaps for the realm. This
49 * update, but don't have enough memory to update our realm hierarchy,
56 * increase ref count for the realm
61 struct ceph_snap_realm *realm)
63 dout("get_realm %p %d -> %d\n", realm,
64 atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
66 * since we _only_ increment realm refs or empty the empty
71 if (atomic_read(&realm->nref) == 0) {
73 list_del_init(&realm->empty_item);
77 atomic_inc(&realm->nref);
103 * create and get the realm rooted at @ino and bump its ref count.
111 struct ceph_snap_realm *realm;
113 realm = kzalloc(sizeof(*realm), GFP_NOFS);
114 if (!realm)
117 atomic_set(&realm->nref, 0); /* tree does not take a ref */
118 realm->ino = ino;
119 INIT_LIST_HEAD(&realm->children);
120 INIT_LIST_HEAD(&realm->child_item);
121 INIT_LIST_HEAD(&realm->empty_item);
122 INIT_LIST_HEAD(&realm->dirty_item);
123 INIT_LIST_HEAD(&realm->inodes_with_caps);
124 spin_lock_init(&realm->inodes_with_caps_lock);
125 __insert_snap_realm(&mdsc->snap_realms, realm);
126 dout("create_snap_realm %llx %p\n", realm->ino, realm);
127 return realm;
131 * lookup the realm rooted at @ino.
156 struct ceph_snap_realm *realm);
162 struct ceph_snap_realm *realm)
164 dout("__destroy_snap_realm %p %llx\n", realm, realm->ino);
166 rb_erase(&realm->node, &mdsc->snap_realms);
168 if (realm->parent) {
169 list_del_init(&realm->child_item);
170 __put_snap_realm(mdsc, realm->parent);
173 kfree(realm->prior_parent_snaps);
174 kfree(realm->snaps);
175 ceph_put_snap_context(realm->cached_context);
176 kfree(realm);
183 struct ceph_snap_realm *realm)
185 dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
186 atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
187 if (atomic_dec_and_test(&realm->nref))
188 __destroy_snap_realm(mdsc, realm);
195 struct ceph_snap_realm *realm)
197 dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
198 atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
199 if (!atomic_dec_and_test(&realm->nref))
203 __destroy_snap_realm(mdsc, realm);
207 list_add(&mdsc->snap_empty, &realm->empty_item);
221 struct ceph_snap_realm *realm;
225 realm = list_first_entry(&mdsc->snap_empty,
227 list_del(&realm->empty_item);
229 __destroy_snap_realm(mdsc, realm);
243 * adjust the parent realm of a given @realm. adjust child list, and parent
251 struct ceph_snap_realm *realm,
256 if (realm->parent_ino == parentino)
266 realm->ino, realm, realm->parent_ino, realm->parent,
268 if (realm->parent) {
269 list_del_init(&realm->child_item);
270 ceph_put_snap_realm(mdsc, realm->parent);
272 realm->parent_ino = parentino;
273 realm->parent = parent;
275 list_add(&realm->child_item, &parent->children);
290 * build the snap context for a given realm.
292 static int build_snap_context(struct ceph_snap_realm *realm)
294 struct ceph_snap_realm *parent = realm->parent;
298 int num = realm->num_prior_parent_snaps + realm->num_snaps;
315 matches realm seq, and my parents' does to. (this works
318 if (realm->cached_context &&
319 realm->cached_context->seq == realm->seq &&
321 realm->cached_context->seq >= parent->cached_context->seq)) {
324 realm->ino, realm, realm->cached_context,
325 realm->cached_context->seq,
326 realm->cached_context->num_snaps);
341 snapc->seq = realm->seq;
347 realm->parent_since)
353 memcpy(snapc->snaps + num, realm->snaps,
354 sizeof(u64)*realm->num_snaps);
355 num += realm->num_snaps;
356 memcpy(snapc->snaps + num, realm->prior_parent_snaps,
357 sizeof(u64)*realm->num_prior_parent_snaps);
358 num += realm->num_prior_parent_snaps;
363 realm->ino, realm, snapc, snapc->seq, snapc->num_snaps);
365 if (realm->cached_context)
366 ceph_put_snap_context(realm->cached_context);
367 realm->cached_context = snapc;
375 if (realm->cached_context) {
376 ceph_put_snap_context(realm->cached_context);
377 realm->cached_context = NULL;
379 pr_err("build_snap_context %llx %p fail %d\n", realm->ino,
380 realm, err);
385 * rebuild snap context for the given realm and all of its children.
387 static void rebuild_snap_realms(struct ceph_snap_realm *realm)
391 dout("rebuild_snap_realms %llx %p\n", realm->ino, realm);
392 build_snap_context(realm);
394 list_for_each_entry(child, &realm->children, child_item)
432 * Caller must hold snap_rwsem for read (i.e., the realm topology won't
557 * Queue cap_snaps for snap writeback for this realm and its children.
558 * Called under snap_rwsem, so realm topology won't change.
560 static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
566 dout("queue_realm_cap_snaps %p %llx inodes\n", realm, realm->ino);
568 spin_lock(&realm->inodes_with_caps_lock);
569 list_for_each_entry(ci, &realm->inodes_with_caps,
574 spin_unlock(&realm->inodes_with_caps_lock);
579 spin_lock(&realm->inodes_with_caps_lock);
581 spin_unlock(&realm->inodes_with_caps_lock);
585 dout("queue_realm_cap_snaps %p %llx children\n", realm, realm->ino);
586 list_for_each_entry(child, &realm->children, child_item)
589 dout("queue_realm_cap_snaps %p %llx done\n", realm, realm->ino);
594 * the snap realm parameters from a given realm and all of its ancestors,
605 struct ceph_snap_realm *realm;
622 realm = ceph_lookup_snap_realm(mdsc, le64_to_cpu(ri->ino));
623 if (!realm) {
624 realm = ceph_create_snap_realm(mdsc, le64_to_cpu(ri->ino));
625 if (IS_ERR(realm)) {
626 err = PTR_ERR(realm);
632 err = adjust_snap_realm_parent(mdsc, realm, le64_to_cpu(ri->parent));
637 if (le64_to_cpu(ri->seq) > realm->seq) {
639 realm->ino, realm, realm->seq, le64_to_cpu(ri->seq));
640 /* update realm parameters, snap lists */
641 realm->seq = le64_to_cpu(ri->seq);
642 realm->created = le64_to_cpu(ri->created);
643 realm->parent_since = le64_to_cpu(ri->parent_since);
645 realm->num_snaps = le32_to_cpu(ri->num_snaps);
646 err = dup_array(&realm->snaps, snaps, realm->num_snaps);
650 realm->num_prior_parent_snaps =
652 err = dup_array(&realm->prior_parent_snaps, prior_parent_snaps,
653 realm->num_prior_parent_snaps);
657 /* queue realm for cap_snap creation */
658 list_add(&realm->dirty_item, &dirty_realms);
661 } else if (!realm->cached_context) {
663 realm->ino, realm, realm->seq);
667 realm->ino, realm, realm->seq);
670 dout("done with %llx %p, invalidated=%d, %p %p\n", realm->ino,
671 realm, invalidate, p, e);
678 rebuild_snap_realms(realm);
684 list_for_each_entry(realm, &dirty_realms, dirty_item) {
685 queue_realm_cap_snaps(realm);
739 * or deletion notification on an existing realm. This should update the
740 * realm and its children.
742 * The more difficult case is realm creation, due to snap creation at a
744 * directory into another realm.
755 struct ceph_snap_realm *realm = NULL;
770 * existing realm */
790 * A "split" breaks part of an existing realm off into
791 * a new realm. The MDS provides a list of inodes
800 /* we will peek at realm info here, but will _not_
801 * advance p, as the realm update will occur below in
805 realm = ceph_lookup_snap_realm(mdsc, split);
806 if (!realm) {
807 realm = ceph_create_snap_realm(mdsc, split);
808 if (IS_ERR(realm))
811 ceph_get_snap_realm(mdsc, realm);
813 dout("splitting snap_realm %llx %p\n", realm->ino, realm);
831 * If this inode belongs to a realm that was
832 * created after our new realm, we experienced
839 dout(" leaving %p in newer realm %llx %p\n",
844 dout(" will move %p to split realm %llx %p\n",
845 inode, realm->ino, realm);
847 * Move the inode to the new realm
849 spin_lock(&realm->inodes_with_caps_lock);
852 &realm->inodes_with_caps);
854 ci->i_snap_realm = realm;
855 spin_unlock(&realm->inodes_with_caps_lock);
858 ceph_get_snap_realm(mdsc, realm);
869 /* we may have taken some of the old realm's children. */
876 adjust_snap_realm_parent(mdsc, child, realm->ino);
888 /* we took a reference when we created the realm, above */
889 ceph_put_snap_realm(mdsc, realm);