* is attached to any writes sent to OSDs.
*/
+
+/*
+ * increase ref count for the realm
+ *
+ * caller must hold snap_rwsem for write.
+ */
+static void get_realm(struct ceph_snap_realm *realm)
+{
+ realm->nref++;
+}
+
/*
* Unfortunately error handling is a bit mixed here. If we get a snap
* update, but don't have enough memory to update our realm hierarchy,
INIT_LIST_HEAD(&realm->child_item);
INIT_LIST_HEAD(&realm->inodes_with_caps);
dout(20, "create_snap_realm %llx %p\n", realm->ino, realm);
- realm->nref = 1;
return realm;
}
if (realm) {
dout(20, "get_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
realm->nref, realm->nref+1);
- realm->nref++;
+ get_realm(realm);
}
return realm;
}
}
realm->parent_ino = parentino;
realm->parent = parent;
+ get_realm(parent);
list_add(&realm->child_item, &parent->children);
return 1;
}
* (the most deeply nested)... we will return if (with
* nref bumped) to the caller. */
first = realm;
- realm->nref++;
+ get_realm(realm);
}
if (le64_to_cpu(ri->seq) > realm->seq) {
if (p == e && invalidate)
rebuild_snap_realms(realm);
- ceph_put_snap_realm(mdsc, realm);
if (p < e)
goto more;
realm = ceph_create_snap_realm(mdsc, split);
if (IS_ERR(realm))
goto out;
+ get_realm(realm);
}
dout(10, "splitting snap_realm %llx %p\n", realm->ino, realm);
list_add(&ci->i_snap_realm_item,
&realm->inodes_with_caps);
ci->i_snap_realm = realm;
- realm->nref++;
+ get_realm(realm);
split_skip_inode:
spin_unlock(&inode->i_lock);
iput(inode);