Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 210047
b: refs/heads/master
c: ed32604
h: refs/heads/master
i:
  210045: dc7ad8e
  210043: e7454de
  210039: 459ad47
  210031: ad8f428
  210015: 6e08dc6
  209983: 074cf67
  209919: 9cf3cd8
v: v3
  • Loading branch information
Sage Weil committed Aug 22, 2010
1 parent 2d7c5a5 commit 6461ab6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a625be47243e0e07dedd0a1a6b94c66c2ab93ba
refs/heads/master: ed326044489ed89c740c50a3df5dffc9c3b20b96
60 changes: 37 additions & 23 deletions trunk/fs/ceph/snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,41 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
return 1; /* caller may want to ceph_flush_snaps */
}

/*
* Queue cap_snaps for snap writeback for this realm and its children.
* Called under snap_rwsem, so realm topology won't change.
*/
static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
{
struct ceph_inode_info *ci;
struct inode *lastinode = NULL;
struct ceph_snap_realm *child;

dout("queue_realm_cap_snaps %p %llx inodes\n", realm, realm->ino);

spin_lock(&realm->inodes_with_caps_lock);
list_for_each_entry(ci, &realm->inodes_with_caps,
i_snap_realm_item) {
struct inode *inode = igrab(&ci->vfs_inode);
if (!inode)
continue;
spin_unlock(&realm->inodes_with_caps_lock);
if (lastinode)
iput(lastinode);
lastinode = inode;
ceph_queue_cap_snap(ci);
spin_lock(&realm->inodes_with_caps_lock);
}
spin_unlock(&realm->inodes_with_caps_lock);
if (lastinode)
iput(lastinode);

dout("queue_realm_cap_snaps %p %llx children\n", realm, realm->ino);
list_for_each_entry(child, &realm->children, child_item)
queue_realm_cap_snaps(child);

dout("queue_realm_cap_snaps %p %llx done\n", realm, realm->ino);
}

/*
* Parse and apply a snapblob "snap trace" from the MDS. This specifies
Expand Down Expand Up @@ -598,29 +633,8 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
*
* ...unless it's a snap deletion!
*/
if (!deletion) {
struct ceph_inode_info *ci;
struct inode *lastinode = NULL;

spin_lock(&realm->inodes_with_caps_lock);
list_for_each_entry(ci, &realm->inodes_with_caps,
i_snap_realm_item) {
struct inode *inode = igrab(&ci->vfs_inode);
if (!inode)
continue;
spin_unlock(&realm->inodes_with_caps_lock);
if (lastinode)
iput(lastinode);
lastinode = inode;
ceph_queue_cap_snap(ci);
spin_lock(&realm->inodes_with_caps_lock);
}
spin_unlock(&realm->inodes_with_caps_lock);
if (lastinode)
iput(lastinode);
dout("update_snap_trace cap_snaps queued\n");
}

if (!deletion)
queue_realm_cap_snaps(realm);
} else {
dout("update_snap_trace %llx %p seq %lld unchanged\n",
realm->ino, realm, realm->seq);
Expand Down

0 comments on commit 6461ab6

Please sign in to comment.