• Yan, Zheng's avatar
    ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference · 5dda377c
    Yan, Zheng authored
    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: default avatarYan, Zheng <zyan@redhat.com>
    5dda377c
file.c 34.9 KB