mirror of https://gitee.com/openkylin/linux.git
ceph: avoid updating mds_wanted too frequently
user space may open/close single file frequently. It's not good to send a clientcaps message to mds for each open/close syscall. Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
7c94ba2790
commit
eb65b919b9
|
@ -1184,6 +1184,13 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
|
||||||
delayed = 1;
|
delayed = 1;
|
||||||
}
|
}
|
||||||
ci->i_ceph_flags &= ~(CEPH_I_NODELAY | CEPH_I_FLUSH);
|
ci->i_ceph_flags &= ~(CEPH_I_NODELAY | CEPH_I_FLUSH);
|
||||||
|
if (want & ~cap->mds_wanted) {
|
||||||
|
/* user space may open/close single file frequently.
|
||||||
|
* This avoids droping mds_wanted immediately after
|
||||||
|
* requesting new mds_wanted.
|
||||||
|
*/
|
||||||
|
__cap_set_timeouts(mdsc, ci);
|
||||||
|
}
|
||||||
|
|
||||||
cap->issued &= retain; /* drop bits we don't want */
|
cap->issued &= retain; /* drop bits we don't want */
|
||||||
if (cap->implemented & ~cap->issued) {
|
if (cap->implemented & ~cap->issued) {
|
||||||
|
@ -2485,15 +2492,14 @@ static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want,
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
mds_wanted = __ceph_caps_mds_wanted(ci);
|
mds_wanted = __ceph_caps_mds_wanted(ci);
|
||||||
if ((mds_wanted & need) != need) {
|
if (need & ~(mds_wanted & need)) {
|
||||||
dout("get_cap_refs %p caps were dropped"
|
dout("get_cap_refs %p caps were dropped"
|
||||||
" (session killed?)\n", inode);
|
" (session killed?)\n", inode);
|
||||||
*err = -ESTALE;
|
*err = -ESTALE;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
if ((mds_wanted & file_wanted) ==
|
if (!(file_wanted & ~mds_wanted))
|
||||||
(file_wanted & (CEPH_CAP_FILE_RD|CEPH_CAP_FILE_WR)))
|
|
||||||
ci->i_ceph_flags &= ~CEPH_I_CAP_DROPPED;
|
ci->i_ceph_flags &= ~CEPH_I_CAP_DROPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue