]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit59a43f8e42522e12a8c9d6695c6ed79680d5924a
tree5b2fddcbf62d8c2b076d2e1040bdd6f5a21e8012
parentea06e2d4cc212161d5d7b787d271c5c3b7698e7c
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