diff options
author | Jeff Layton <jlayton@redhat.com> | 2016-11-10 07:42:06 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-12-12 17:54:28 -0500 |
commit | 1e4ef0c6332bd90e6c70afc07b35dffaf1eab1a7 (patch) | |
tree | 655329cb717f07afcf344759a133477f2f4bcfda /fs/ceph | |
parent | 43b29673307387f7b939fceeedefd08ece13c41d (diff) |
ceph: add flags parameter to send_cap_msg
Add a flags parameter to send_cap_msg, so we can request expedited
service from the MDS when we know we'll be waiting on the result.
Set that flag in the case of try_flush_caps. The callers of that
function generally wait synchronously on the result, so it's beneficial
to ask the server to expedite it.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/caps.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 508663ed413c..b54af160526e 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -996,6 +996,7 @@ struct cap_msg_args { | |||
996 | struct timespec atime, mtime, ctime; | 996 | struct timespec atime, mtime, ctime; |
997 | int op, caps, wanted, dirty; | 997 | int op, caps, wanted, dirty; |
998 | u32 seq, issue_seq, mseq, time_warp_seq; | 998 | u32 seq, issue_seq, mseq, time_warp_seq; |
999 | u32 flags; | ||
999 | kuid_t uid; | 1000 | kuid_t uid; |
1000 | kgid_t gid; | 1001 | kgid_t gid; |
1001 | umode_t mode; | 1002 | umode_t mode; |
@@ -1104,7 +1105,7 @@ static int send_cap_msg(struct cap_msg_args *arg) | |||
1104 | ceph_encode_64(&p, 0); | 1105 | ceph_encode_64(&p, 0); |
1105 | 1106 | ||
1106 | /* Advisory flags (version 10) */ | 1107 | /* Advisory flags (version 10) */ |
1107 | ceph_encode_32(&p, 0); | 1108 | ceph_encode_32(&p, arg->flags); |
1108 | 1109 | ||
1109 | ceph_con_send(&arg->session->s_con, msg); | 1110 | ceph_con_send(&arg->session->s_con, msg); |
1110 | return 0; | 1111 | return 0; |
@@ -1145,8 +1146,8 @@ void ceph_queue_caps_release(struct inode *inode) | |||
1145 | * caller should hold snap_rwsem (read), s_mutex. | 1146 | * caller should hold snap_rwsem (read), s_mutex. |
1146 | */ | 1147 | */ |
1147 | static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | 1148 | static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, |
1148 | int op, int used, int want, int retain, int flushing, | 1149 | int op, bool sync, int used, int want, int retain, |
1149 | u64 flush_tid, u64 oldest_flush_tid) | 1150 | int flushing, u64 flush_tid, u64 oldest_flush_tid) |
1150 | __releases(cap->ci->i_ceph_lock) | 1151 | __releases(cap->ci->i_ceph_lock) |
1151 | { | 1152 | { |
1152 | struct ceph_inode_info *ci = cap->ci; | 1153 | struct ceph_inode_info *ci = cap->ci; |
@@ -1235,6 +1236,9 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1235 | arg.mode = inode->i_mode; | 1236 | arg.mode = inode->i_mode; |
1236 | 1237 | ||
1237 | arg.inline_data = ci->i_inline_version != CEPH_INLINE_NONE; | 1238 | arg.inline_data = ci->i_inline_version != CEPH_INLINE_NONE; |
1239 | arg.flags = 0; | ||
1240 | if (sync) | ||
1241 | arg.flags |= CEPH_CLIENT_CAPS_SYNC; | ||
1238 | 1242 | ||
1239 | spin_unlock(&ci->i_ceph_lock); | 1243 | spin_unlock(&ci->i_ceph_lock); |
1240 | 1244 | ||
@@ -1288,6 +1292,7 @@ static inline int __send_flush_snap(struct inode *inode, | |||
1288 | arg.mode = capsnap->mode; | 1292 | arg.mode = capsnap->mode; |
1289 | 1293 | ||
1290 | arg.inline_data = capsnap->inline_data; | 1294 | arg.inline_data = capsnap->inline_data; |
1295 | arg.flags = 0; | ||
1291 | 1296 | ||
1292 | return send_cap_msg(&arg); | 1297 | return send_cap_msg(&arg); |
1293 | } | 1298 | } |
@@ -1912,9 +1917,9 @@ ack: | |||
1912 | sent++; | 1917 | sent++; |
1913 | 1918 | ||
1914 | /* __send_cap drops i_ceph_lock */ | 1919 | /* __send_cap drops i_ceph_lock */ |
1915 | delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, cap_used, | 1920 | delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, false, |
1916 | want, retain, flushing, | 1921 | cap_used, want, retain, flushing, |
1917 | flush_tid, oldest_flush_tid); | 1922 | flush_tid, oldest_flush_tid); |
1918 | goto retry; /* retake i_ceph_lock and restart our cap scan. */ | 1923 | goto retry; /* retake i_ceph_lock and restart our cap scan. */ |
1919 | } | 1924 | } |
1920 | 1925 | ||
@@ -1978,9 +1983,9 @@ retry: | |||
1978 | &flush_tid, &oldest_flush_tid); | 1983 | &flush_tid, &oldest_flush_tid); |
1979 | 1984 | ||
1980 | /* __send_cap drops i_ceph_lock */ | 1985 | /* __send_cap drops i_ceph_lock */ |
1981 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, used, want, | 1986 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, true, |
1982 | (cap->issued | cap->implemented), | 1987 | used, want, (cap->issued | cap->implemented), |
1983 | flushing, flush_tid, oldest_flush_tid); | 1988 | flushing, flush_tid, oldest_flush_tid); |
1984 | 1989 | ||
1985 | if (delayed) { | 1990 | if (delayed) { |
1986 | spin_lock(&ci->i_ceph_lock); | 1991 | spin_lock(&ci->i_ceph_lock); |
@@ -2173,7 +2178,7 @@ static void __kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
2173 | inode, cap, cf->tid, ceph_cap_string(cf->caps)); | 2178 | inode, cap, cf->tid, ceph_cap_string(cf->caps)); |
2174 | ci->i_ceph_flags |= CEPH_I_NODELAY; | 2179 | ci->i_ceph_flags |= CEPH_I_NODELAY; |
2175 | ret = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, | 2180 | ret = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, |
2176 | __ceph_caps_used(ci), | 2181 | false, __ceph_caps_used(ci), |
2177 | __ceph_caps_wanted(ci), | 2182 | __ceph_caps_wanted(ci), |
2178 | cap->issued | cap->implemented, | 2183 | cap->issued | cap->implemented, |
2179 | cf->caps, cf->tid, oldest_flush_tid); | 2184 | cf->caps, cf->tid, oldest_flush_tid); |