]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/ceph/caps.c
ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference
authorYan, Zheng <zyan@redhat.com>
Thu, 30 Apr 2015 06:40:54 +0000 (14:40 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 25 Jun 2015 08:49:28 +0000 (11:49 +0300)
commit5dda377cf0a6bd43f64a3c1efb670d7c668e7b29
tree5b2fddcbf62d8c2b076d2e1040bdd6f5a21e8012
parent7b06a826e7c52d77ce801e5960ecf0338eafe886
ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference

In most cases that snap context is needed, we are holding
reference of CEPH_CAP_FILE_WR. So we can set ceph inode's
i_head_snapc when getting the CEPH_CAP_FILE_WR reference,
and make codes get snap context from i_head_snapc. This makes
the code simpler.

Another benefit of this change is that we can handle snap
notification more elegantly. Especially when snap context
is updated while someone else is doing write. The old queue
cap_snap code may set cap_snap's context to ether the old
context or the new snap context, depending on if i_head_snapc
is set. The new queue capp_snap code always set cap_snap's
context to the old snap context.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/addr.c
fs/ceph/caps.c
fs/ceph/file.c
fs/ceph/snap.c