Lines Matching full:mdsc

49 static u64 __get_oldest_flush_tid(struct ceph_mds_client *mdsc);
50 static void __kick_flushing_caps(struct ceph_mds_client *mdsc,
131 void ceph_caps_init(struct ceph_mds_client *mdsc) in ceph_caps_init() argument
133 INIT_LIST_HEAD(&mdsc->caps_list); in ceph_caps_init()
134 spin_lock_init(&mdsc->caps_list_lock); in ceph_caps_init()
137 void ceph_caps_finalize(struct ceph_mds_client *mdsc) in ceph_caps_finalize() argument
141 spin_lock(&mdsc->caps_list_lock); in ceph_caps_finalize()
142 while (!list_empty(&mdsc->caps_list)) { in ceph_caps_finalize()
143 cap = list_first_entry(&mdsc->caps_list, in ceph_caps_finalize()
148 mdsc->caps_total_count = 0; in ceph_caps_finalize()
149 mdsc->caps_avail_count = 0; in ceph_caps_finalize()
150 mdsc->caps_use_count = 0; in ceph_caps_finalize()
151 mdsc->caps_reserve_count = 0; in ceph_caps_finalize()
152 mdsc->caps_min_count = 0; in ceph_caps_finalize()
153 spin_unlock(&mdsc->caps_list_lock); in ceph_caps_finalize()
156 void ceph_adjust_caps_max_min(struct ceph_mds_client *mdsc, in ceph_adjust_caps_max_min() argument
159 spin_lock(&mdsc->caps_list_lock); in ceph_adjust_caps_max_min()
160 mdsc->caps_min_count = fsopt->max_readdir; in ceph_adjust_caps_max_min()
161 if (mdsc->caps_min_count < 1024) in ceph_adjust_caps_max_min()
162 mdsc->caps_min_count = 1024; in ceph_adjust_caps_max_min()
163 mdsc->caps_use_max = fsopt->caps_max; in ceph_adjust_caps_max_min()
164 if (mdsc->caps_use_max > 0 && in ceph_adjust_caps_max_min()
165 mdsc->caps_use_max < mdsc->caps_min_count) in ceph_adjust_caps_max_min()
166 mdsc->caps_use_max = mdsc->caps_min_count; in ceph_adjust_caps_max_min()
167 spin_unlock(&mdsc->caps_list_lock); in ceph_adjust_caps_max_min()
170 static void __ceph_unreserve_caps(struct ceph_mds_client *mdsc, int nr_caps) in __ceph_unreserve_caps() argument
176 BUG_ON(mdsc->caps_reserve_count < nr_caps); in __ceph_unreserve_caps()
177 mdsc->caps_reserve_count -= nr_caps; in __ceph_unreserve_caps()
178 if (mdsc->caps_avail_count >= in __ceph_unreserve_caps()
179 mdsc->caps_reserve_count + mdsc->caps_min_count) { in __ceph_unreserve_caps()
180 mdsc->caps_total_count -= nr_caps; in __ceph_unreserve_caps()
182 cap = list_first_entry(&mdsc->caps_list, in __ceph_unreserve_caps()
188 mdsc->caps_avail_count += nr_caps; in __ceph_unreserve_caps()
191 doutc(mdsc->fsc->client, in __ceph_unreserve_caps()
193 mdsc->caps_total_count, mdsc->caps_use_count, in __ceph_unreserve_caps()
194 mdsc->caps_reserve_count, mdsc->caps_avail_count); in __ceph_unreserve_caps()
195 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in __ceph_unreserve_caps()
196 mdsc->caps_reserve_count + in __ceph_unreserve_caps()
197 mdsc->caps_avail_count); in __ceph_unreserve_caps()
202 * Called under mdsc->mutex.
204 int ceph_reserve_caps(struct ceph_mds_client *mdsc, in ceph_reserve_caps() argument
207 struct ceph_client *cl = mdsc->fsc->client; in ceph_reserve_caps()
221 spin_lock(&mdsc->caps_list_lock); in ceph_reserve_caps()
222 if (mdsc->caps_avail_count >= need) in ceph_reserve_caps()
225 have = mdsc->caps_avail_count; in ceph_reserve_caps()
226 mdsc->caps_avail_count -= have; in ceph_reserve_caps()
227 mdsc->caps_reserve_count += have; in ceph_reserve_caps()
228 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_reserve_caps()
229 mdsc->caps_reserve_count + in ceph_reserve_caps()
230 mdsc->caps_avail_count); in ceph_reserve_caps()
231 spin_unlock(&mdsc->caps_list_lock); in ceph_reserve_caps()
243 for (j = 0; j < mdsc->max_sessions; j++) { in ceph_reserve_caps()
244 s = __ceph_lookup_mds_session(mdsc, j); in ceph_reserve_caps()
247 mutex_unlock(&mdsc->mutex); in ceph_reserve_caps()
251 ceph_trim_caps(mdsc, s, max_caps); in ceph_reserve_caps()
255 mutex_lock(&mdsc->mutex); in ceph_reserve_caps()
259 spin_lock(&mdsc->caps_list_lock); in ceph_reserve_caps()
260 if (mdsc->caps_avail_count) { in ceph_reserve_caps()
262 if (mdsc->caps_avail_count >= need - i) in ceph_reserve_caps()
265 more_have = mdsc->caps_avail_count; in ceph_reserve_caps()
269 mdsc->caps_avail_count -= more_have; in ceph_reserve_caps()
270 mdsc->caps_reserve_count += more_have; in ceph_reserve_caps()
273 spin_unlock(&mdsc->caps_list_lock); in ceph_reserve_caps()
290 spin_lock(&mdsc->caps_list_lock); in ceph_reserve_caps()
291 mdsc->caps_total_count += alloc; in ceph_reserve_caps()
292 mdsc->caps_reserve_count += alloc; in ceph_reserve_caps()
293 list_splice(&newcaps, &mdsc->caps_list); in ceph_reserve_caps()
295 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_reserve_caps()
296 mdsc->caps_reserve_count + in ceph_reserve_caps()
297 mdsc->caps_avail_count); in ceph_reserve_caps()
300 __ceph_unreserve_caps(mdsc, have + alloc); in ceph_reserve_caps()
302 spin_unlock(&mdsc->caps_list_lock); in ceph_reserve_caps()
305 mdsc->caps_total_count, mdsc->caps_use_count, in ceph_reserve_caps()
306 mdsc->caps_reserve_count, mdsc->caps_avail_count); in ceph_reserve_caps()
310 void ceph_unreserve_caps(struct ceph_mds_client *mdsc, in ceph_unreserve_caps() argument
313 struct ceph_client *cl = mdsc->fsc->client; in ceph_unreserve_caps()
319 spin_lock(&mdsc->caps_list_lock); in ceph_unreserve_caps()
320 __ceph_unreserve_caps(mdsc, ctx->count); in ceph_unreserve_caps()
323 if (mdsc->caps_use_max > 0 && in ceph_unreserve_caps()
324 mdsc->caps_use_count > mdsc->caps_use_max) in ceph_unreserve_caps()
326 spin_unlock(&mdsc->caps_list_lock); in ceph_unreserve_caps()
329 ceph_reclaim_caps_nr(mdsc, ctx->used); in ceph_unreserve_caps()
332 struct ceph_cap *ceph_get_cap(struct ceph_mds_client *mdsc, in ceph_get_cap() argument
335 struct ceph_client *cl = mdsc->fsc->client; in ceph_get_cap()
342 spin_lock(&mdsc->caps_list_lock); in ceph_get_cap()
343 mdsc->caps_use_count++; in ceph_get_cap()
344 mdsc->caps_total_count++; in ceph_get_cap()
345 spin_unlock(&mdsc->caps_list_lock); in ceph_get_cap()
347 spin_lock(&mdsc->caps_list_lock); in ceph_get_cap()
348 if (mdsc->caps_avail_count) { in ceph_get_cap()
349 BUG_ON(list_empty(&mdsc->caps_list)); in ceph_get_cap()
351 mdsc->caps_avail_count--; in ceph_get_cap()
352 mdsc->caps_use_count++; in ceph_get_cap()
353 cap = list_first_entry(&mdsc->caps_list, in ceph_get_cap()
357 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_get_cap()
358 mdsc->caps_reserve_count + mdsc->caps_avail_count); in ceph_get_cap()
360 spin_unlock(&mdsc->caps_list_lock); in ceph_get_cap()
366 spin_lock(&mdsc->caps_list_lock); in ceph_get_cap()
368 ctx->count, mdsc->caps_total_count, mdsc->caps_use_count, in ceph_get_cap()
369 mdsc->caps_reserve_count, mdsc->caps_avail_count); in ceph_get_cap()
371 BUG_ON(ctx->count > mdsc->caps_reserve_count); in ceph_get_cap()
372 BUG_ON(list_empty(&mdsc->caps_list)); in ceph_get_cap()
376 mdsc->caps_reserve_count--; in ceph_get_cap()
377 mdsc->caps_use_count++; in ceph_get_cap()
379 cap = list_first_entry(&mdsc->caps_list, struct ceph_cap, caps_item); in ceph_get_cap()
382 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_get_cap()
383 mdsc->caps_reserve_count + mdsc->caps_avail_count); in ceph_get_cap()
384 spin_unlock(&mdsc->caps_list_lock); in ceph_get_cap()
388 void ceph_put_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap) in ceph_put_cap() argument
390 struct ceph_client *cl = mdsc->fsc->client; in ceph_put_cap()
392 spin_lock(&mdsc->caps_list_lock); in ceph_put_cap()
394 mdsc->caps_total_count, mdsc->caps_use_count, in ceph_put_cap()
395 mdsc->caps_reserve_count, mdsc->caps_avail_count); in ceph_put_cap()
396 mdsc->caps_use_count--; in ceph_put_cap()
401 if (mdsc->caps_avail_count >= mdsc->caps_reserve_count + in ceph_put_cap()
402 mdsc->caps_min_count) { in ceph_put_cap()
403 mdsc->caps_total_count--; in ceph_put_cap()
406 mdsc->caps_avail_count++; in ceph_put_cap()
407 list_add(&cap->caps_item, &mdsc->caps_list); in ceph_put_cap()
410 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_put_cap()
411 mdsc->caps_reserve_count + mdsc->caps_avail_count); in ceph_put_cap()
412 spin_unlock(&mdsc->caps_list_lock); in ceph_put_cap()
419 struct ceph_mds_client *mdsc = fsc->mdsc; in ceph_reservation_status() local
421 spin_lock(&mdsc->caps_list_lock); in ceph_reservation_status()
424 *total = mdsc->caps_total_count; in ceph_reservation_status()
426 *avail = mdsc->caps_avail_count; in ceph_reservation_status()
428 *used = mdsc->caps_use_count; in ceph_reservation_status()
430 *reserved = mdsc->caps_reserve_count; in ceph_reservation_status()
432 *min = mdsc->caps_min_count; in ceph_reservation_status()
434 spin_unlock(&mdsc->caps_list_lock); in ceph_reservation_status()
498 static void __cap_set_timeouts(struct ceph_mds_client *mdsc, in __cap_set_timeouts() argument
502 struct ceph_mount_options *opt = mdsc->fsc->mount_options; in __cap_set_timeouts()
506 doutc(mdsc->fsc->client, "%p %llx.%llx %lu\n", inode, in __cap_set_timeouts()
516 * -> we take mdsc->cap_delay_lock
518 static void __cap_delay_requeue(struct ceph_mds_client *mdsc, in __cap_delay_requeue() argument
523 doutc(mdsc->fsc->client, "%p %llx.%llx flags 0x%lx at %lu\n", in __cap_delay_requeue()
526 if (!mdsc->stopping) { in __cap_delay_requeue()
527 spin_lock(&mdsc->cap_delay_lock); in __cap_delay_requeue()
533 __cap_set_timeouts(mdsc, ci); in __cap_delay_requeue()
534 list_add_tail(&ci->i_cap_delay_list, &mdsc->cap_delay_list); in __cap_delay_requeue()
536 spin_unlock(&mdsc->cap_delay_lock); in __cap_delay_requeue()
545 static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc, in __cap_delay_requeue_front() argument
550 doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, ceph_vinop(inode)); in __cap_delay_requeue_front()
551 spin_lock(&mdsc->cap_delay_lock); in __cap_delay_requeue_front()
555 list_add(&ci->i_cap_delay_list, &mdsc->cap_delay_list); in __cap_delay_requeue_front()
556 spin_unlock(&mdsc->cap_delay_lock); in __cap_delay_requeue_front()
564 static void __cap_delay_cancel(struct ceph_mds_client *mdsc, in __cap_delay_cancel() argument
569 doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, ceph_vinop(inode)); in __cap_delay_cancel()
572 spin_lock(&mdsc->cap_delay_lock); in __cap_delay_cancel()
574 spin_unlock(&mdsc->cap_delay_lock); in __cap_delay_cancel()
657 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in ceph_add_cap() local
692 atomic64_inc(&mdsc->metric.total_caps); in ceph_add_cap()
727 struct ceph_snap_realm *realm = ceph_lookup_snap_realm(mdsc, in ceph_add_cap()
750 __cap_delay_requeue(mdsc, ci); in ceph_add_cap()
958 ceph_update_cap_hit(&fsc->mdsc->metric); in __ceph_caps_issued_mask_metric()
960 ceph_update_cap_mis(&fsc->mdsc->metric); in __ceph_caps_issued_mask_metric()
1128 struct ceph_mds_client *mdsc; in __ceph_remove_cap() local
1141 mdsc = ceph_inode_to_fs_client(&ci->netfs.inode)->mdsc; in __ceph_remove_cap()
1157 atomic64_dec(&mdsc->metric.total_caps); in __ceph_remove_cap()
1184 ceph_put_cap(mdsc, cap); in __ceph_remove_cap()
1194 __cap_delay_cancel(mdsc, ci); in __ceph_remove_cap()
1198 void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, in ceph_remove_cap() argument
1206 doutc(mdsc->fsc->client, "inode is NULL\n"); in ceph_remove_cap()
1248 struct ceph_mds_client *mdsc = arg->session->s_mdsc; in encode_cap_msg() local
1249 struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc; in encode_cap_msg()
1251 doutc(mdsc->fsc->client, in encode_cap_msg()
1368 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in __ceph_remove_caps() local
1378 ceph_remove_cap(mdsc, cap, true); in __ceph_remove_caps()
1623 struct ceph_mds_client *mdsc = session->s_mdsc; in __ceph_flush_snaps() local
1624 struct ceph_client *cl = mdsc->fsc->client; in __ceph_flush_snaps()
1649 spin_lock(&mdsc->cap_dirty_lock); in __ceph_flush_snaps()
1650 capsnap->cap_flush.tid = ++mdsc->last_cap_flush_tid; in __ceph_flush_snaps()
1652 &mdsc->cap_flush_list); in __ceph_flush_snaps()
1654 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in __ceph_flush_snaps()
1659 spin_unlock(&mdsc->cap_dirty_lock); in __ceph_flush_snaps()
1721 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in ceph_flush_snaps() local
1749 mutex_lock(&mdsc->mutex); in ceph_flush_snaps()
1750 session = __ceph_lookup_mds_session(mdsc, mds); in ceph_flush_snaps()
1751 mutex_unlock(&mdsc->mutex); in ceph_flush_snaps()
1757 __kick_flushing_caps(mdsc, session, ci, 0); in ceph_flush_snaps()
1768 spin_lock(&mdsc->snap_flush_lock); in ceph_flush_snaps()
1772 spin_unlock(&mdsc->snap_flush_lock); in ceph_flush_snaps()
1786 struct ceph_mds_client *mdsc = in __ceph_mark_dirty_caps() local
1787 ceph_sb_to_fs_client(ci->netfs.inode.i_sb)->mdsc; in __ceph_mark_dirty_caps()
1814 WARN_ON_ONCE(!rwsem_is_locked(&mdsc->snap_rwsem)); in __ceph_mark_dirty_caps()
1822 spin_lock(&mdsc->cap_dirty_lock); in __ceph_mark_dirty_caps()
1824 spin_unlock(&mdsc->cap_dirty_lock); in __ceph_mark_dirty_caps()
1836 __cap_delay_requeue(mdsc, ci); in __ceph_mark_dirty_caps()
1858 static u64 __get_oldest_flush_tid(struct ceph_mds_client *mdsc) in __get_oldest_flush_tid() argument
1860 if (!list_empty(&mdsc->cap_flush_list)) { in __get_oldest_flush_tid()
1862 list_first_entry(&mdsc->cap_flush_list, in __get_oldest_flush_tid()
1870 * Remove cap_flush from the mdsc's or inode's flushing cap list.
1873 static bool __detach_cap_flush_from_mdsc(struct ceph_mds_client *mdsc, in __detach_cap_flush_from_mdsc() argument
1879 if (wake && cf->g_list.prev != &mdsc->cap_flush_list) { in __detach_cap_flush_from_mdsc()
1913 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in __mark_caps_flushing() local
1937 spin_lock(&mdsc->cap_dirty_lock); in __mark_caps_flushing()
1940 cf->tid = ++mdsc->last_cap_flush_tid; in __mark_caps_flushing()
1941 list_add_tail(&cf->g_list, &mdsc->cap_flush_list); in __mark_caps_flushing()
1942 *oldest_flush_tid = __get_oldest_flush_tid(mdsc); in __mark_caps_flushing()
1946 mdsc->num_cap_flushing++; in __mark_caps_flushing()
1948 spin_unlock(&mdsc->cap_dirty_lock); in __mark_caps_flushing()
2013 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb); in ceph_check_caps() local
2058 if (!mdsc->stopping && inode->i_nlink > 0) { in ceph_check_caps()
2106 if ((!(flags & CHECK_CAPS_NOINVAL) || mdsc->stopping) && in ceph_check_caps()
2228 __kick_flushing_caps(mdsc, session, ci, 0); in ceph_check_caps()
2245 spin_lock(&mdsc->cap_dirty_lock); in ceph_check_caps()
2246 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_check_caps()
2247 spin_unlock(&mdsc->cap_dirty_lock); in ceph_check_caps()
2267 __cap_delay_requeue(mdsc, ci); in ceph_check_caps()
2284 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in try_flush_caps() local
2304 __kick_flushing_caps(mdsc, session, ci, 0); in try_flush_caps()
2362 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in flush_mdlog_and_wait_inode_unsafe_requests() local
2395 mutex_lock(&mdsc->mutex); in flush_mdlog_and_wait_inode_unsafe_requests()
2396 max_sessions = mdsc->max_sessions; in flush_mdlog_and_wait_inode_unsafe_requests()
2400 mutex_unlock(&mdsc->mutex); in flush_mdlog_and_wait_inode_unsafe_requests()
2440 mutex_unlock(&mdsc->mutex); in flush_mdlog_and_wait_inode_unsafe_requests()
2550 struct ceph_mds_client *mdsc = in ceph_write_inode() local
2551 ceph_sb_to_fs_client(inode->i_sb)->mdsc; in ceph_write_inode()
2555 __cap_delay_requeue_front(mdsc, ci); in ceph_write_inode()
2561 static void __kick_flushing_caps(struct ceph_mds_client *mdsc, in __kick_flushing_caps() argument
2569 struct ceph_client *cl = mdsc->fsc->client; in __kick_flushing_caps()
2644 void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, in ceph_early_kick_flushing_caps() argument
2647 struct ceph_client *cl = mdsc->fsc->client; in ceph_early_kick_flushing_caps()
2654 spin_lock(&mdsc->cap_dirty_lock); in ceph_early_kick_flushing_caps()
2655 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_early_kick_flushing_caps()
2656 spin_unlock(&mdsc->cap_dirty_lock); in ceph_early_kick_flushing_caps()
2686 __kick_flushing_caps(mdsc, session, ci, in ceph_early_kick_flushing_caps()
2696 void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, in ceph_kick_flushing_caps() argument
2699 struct ceph_client *cl = mdsc->fsc->client; in ceph_kick_flushing_caps()
2708 spin_lock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_caps()
2709 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_kick_flushing_caps()
2710 spin_unlock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_caps()
2725 __kick_flushing_caps(mdsc, session, ci, in ceph_kick_flushing_caps()
2735 struct ceph_mds_client *mdsc = session->s_mdsc; in ceph_kick_flushing_inode_caps() local
2741 doutc(mdsc->fsc->client, "%p %llx.%llx flushing %s\n", in ceph_kick_flushing_inode_caps()
2747 spin_lock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_inode_caps()
2750 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_kick_flushing_inode_caps()
2751 spin_unlock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_inode_caps()
2753 __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); in ceph_kick_flushing_inode_caps()
2818 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in try_get_cap_refs() local
2843 up_read(&mdsc->snap_rwsem); in try_get_cap_refs()
2891 if (!down_read_trylock(&mdsc->snap_rwsem)) { in try_get_cap_refs()
2902 down_read(&mdsc->snap_rwsem); in try_get_cap_refs()
2954 __ceph_touch_fmode(ci, mdsc, flags); in try_get_cap_refs()
2958 up_read(&mdsc->snap_rwsem); in try_get_cap_refs()
2961 ceph_update_cap_mis(&mdsc->metric); in try_get_cap_refs()
2963 ceph_update_cap_hit(&mdsc->metric); in try_get_cap_refs()
3067 struct ceph_mds_client *mdsc = fsc->mdsc; in __ceph_get_caps() local
3078 spin_lock(&mdsc->caps_list_lock); in __ceph_get_caps()
3079 list_add(&cw.list, &mdsc->cap_wait_list); in __ceph_get_caps()
3080 spin_unlock(&mdsc->caps_list_lock); in __ceph_get_caps()
3101 spin_lock(&mdsc->caps_list_lock); in __ceph_get_caps()
3103 spin_unlock(&mdsc->caps_list_lock); in __ceph_get_caps()
3818 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in handle_cap_flush_ack() local
3819 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_flush_ack()
3867 spin_lock(&mdsc->cap_dirty_lock); in handle_cap_flush_ack()
3870 wake_mdsc |= __detach_cap_flush_from_mdsc(mdsc, cf); in handle_cap_flush_ack()
3884 mdsc->num_cap_flushing--; in handle_cap_flush_ack()
3903 spin_unlock(&mdsc->cap_dirty_lock); in handle_cap_flush_ack()
3919 wake_up_all(&mdsc->cap_flushing_wq); in handle_cap_flush_ack()
3928 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in __ceph_remove_capsnap() local
3929 struct ceph_client *cl = mdsc->fsc->client; in __ceph_remove_capsnap()
3942 spin_lock(&mdsc->cap_dirty_lock); in __ceph_remove_capsnap()
3946 ret = __detach_cap_flush_from_mdsc(mdsc, &capsnap->cap_flush); in __ceph_remove_capsnap()
3949 spin_unlock(&mdsc->cap_dirty_lock); in __ceph_remove_capsnap()
3974 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in handle_cap_flushsnap_ack() local
3975 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_flushsnap_ack()
4011 wake_up_all(&mdsc->cap_flushing_wq); in handle_cap_flushsnap_ack()
4069 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in handle_cap_export() local
4070 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_export()
4092 down_read(&mdsc->snap_rwsem); in handle_cap_export()
4099 ceph_remove_cap(mdsc, cap, false); in handle_cap_export()
4136 ceph_remove_cap(mdsc, cap, false); in handle_cap_export()
4147 spin_lock(&mdsc->cap_dirty_lock); in handle_cap_export()
4150 spin_unlock(&mdsc->cap_dirty_lock); in handle_cap_export()
4153 ceph_remove_cap(mdsc, cap, false); in handle_cap_export()
4158 up_read(&mdsc->snap_rwsem); in handle_cap_export()
4162 tsession = ceph_mdsc_open_export_target_session(mdsc, target); in handle_cap_export()
4173 new_cap = ceph_get_cap(mdsc, NULL); in handle_cap_export()
4184 up_read(&mdsc->snap_rwsem); in handle_cap_export()
4191 ceph_put_cap(mdsc, new_cap); in handle_cap_export()
4199 static void handle_cap_import(struct ceph_mds_client *mdsc, in handle_cap_import() argument
4206 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_import()
4238 new_cap = ceph_get_cap(mdsc, NULL); in handle_cap_import()
4245 ceph_put_cap(mdsc, new_cap); in handle_cap_import()
4269 ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE)); in handle_cap_import()
4331 struct ceph_mds_client *mdsc = session->s_mdsc; in ceph_handle_caps() local
4332 struct ceph_client *cl = mdsc->fsc->client; in ceph_handle_caps()
4351 if (!ceph_inc_mds_stopping_blocker(mdsc, session)) in ceph_handle_caps()
4400 struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc; in ceph_handle_caps()
4451 inode = ceph_find_inode(mdsc->fsc->sb, vino); in ceph_handle_caps()
4456 trace_ceph_handle_caps(mdsc, session, op, &vino, ceph_inode(inode), in ceph_handle_caps()
4491 down_write(&mdsc->snap_rwsem); in ceph_handle_caps()
4492 if (ceph_update_snap_trace(mdsc, snaptrace, in ceph_handle_caps()
4495 up_write(&mdsc->snap_rwsem); in ceph_handle_caps()
4499 downgrade_write(&mdsc->snap_rwsem); in ceph_handle_caps()
4501 down_read(&mdsc->snap_rwsem); in ceph_handle_caps()
4504 handle_cap_import(mdsc, inode, h, peer, session, in ceph_handle_caps()
4509 ceph_put_snap_realm(mdsc, realm); in ceph_handle_caps()
4566 ceph_dec_mds_stopping_blocker(mdsc); in ceph_handle_caps()
4572 ceph_mdsc_close_sessions(mdsc); in ceph_handle_caps()
4584 cap = ceph_get_cap(mdsc, NULL); in ceph_handle_caps()
4595 ceph_flush_session_cap_releases(mdsc, session); in ceph_handle_caps()
4611 unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc) in ceph_check_delayed_caps() argument
4613 struct ceph_client *cl = mdsc->fsc->client; in ceph_check_delayed_caps()
4616 struct ceph_mount_options *opt = mdsc->fsc->mount_options; in ceph_check_delayed_caps()
4622 spin_lock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4623 while (!list_empty(&mdsc->cap_delay_list)) { in ceph_check_delayed_caps()
4624 ci = list_first_entry(&mdsc->cap_delay_list, in ceph_check_delayed_caps()
4639 spin_unlock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4644 spin_lock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4649 * slowness doesn't block mdsc delayed work, in ceph_check_delayed_caps()
4655 spin_unlock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4666 struct ceph_mds_client *mdsc = s->s_mdsc; in flush_dirty_session_caps() local
4667 struct ceph_client *cl = mdsc->fsc->client; in flush_dirty_session_caps()
4672 spin_lock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4679 spin_unlock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4683 spin_lock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4685 spin_unlock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4689 void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc) in ceph_flush_dirty_caps() argument
4691 ceph_mdsc_iterate_sessions(mdsc, flush_dirty_session_caps, true); in ceph_flush_dirty_caps()
4699 struct ceph_mds_client *mdsc = s->s_mdsc; in flush_cap_releases() local
4700 struct ceph_client *cl = mdsc->fsc->client; in flush_cap_releases()
4705 ceph_flush_session_cap_releases(mdsc, s); in flush_cap_releases()
4711 void ceph_flush_cap_releases(struct ceph_mds_client *mdsc) in ceph_flush_cap_releases() argument
4713 ceph_mdsc_iterate_sessions(mdsc, flush_cap_releases, true); in ceph_flush_cap_releases()
4717 struct ceph_mds_client *mdsc, int fmode) in __ceph_touch_fmode() argument
4728 __cap_delay_requeue(mdsc, ci); in __ceph_touch_fmode()
4733 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->netfs.inode.i_sb); in ceph_get_fmode() local
4739 atomic64_inc(&mdsc->metric.opened_files); in ceph_get_fmode()
4756 percpu_counter_inc(&mdsc->metric.opened_inodes); in ceph_get_fmode()
4767 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->netfs.inode.i_sb); in ceph_put_fmode() local
4773 atomic64_dec(&mdsc->metric.opened_files); in ceph_put_fmode()
4792 percpu_counter_dec(&mdsc->metric.opened_inodes); in ceph_put_fmode()
4812 struct ceph_mds_client *mdsc = in ceph_drop_caps_for_unlink() local
4813 ceph_inode_to_fs_client(inode)->mdsc; in ceph_drop_caps_for_unlink()
4815 doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, in ceph_drop_caps_for_unlink()
4817 spin_lock(&mdsc->cap_delay_lock); in ceph_drop_caps_for_unlink()
4822 &mdsc->cap_unlink_delay_list); in ceph_drop_caps_for_unlink()
4823 spin_unlock(&mdsc->cap_delay_lock); in ceph_drop_caps_for_unlink()
4829 ceph_queue_cap_unlink_work(mdsc); in ceph_drop_caps_for_unlink()
4984 static int remove_capsnaps(struct ceph_mds_client *mdsc, struct inode *inode) in remove_capsnaps() argument
4987 struct ceph_client *cl = mdsc->fsc->client; in remove_capsnaps()
5005 wake_up_all(&mdsc->cap_flushing_wq); in remove_capsnaps()
5012 struct ceph_mds_client *mdsc = fsc->mdsc; in ceph_purge_inode_cap() local
5036 spin_lock(&mdsc->cap_dirty_lock); in ceph_purge_inode_cap()
5064 mdsc->num_cap_flushing--; in ceph_purge_inode_cap()
5067 spin_unlock(&mdsc->cap_dirty_lock); in ceph_purge_inode_cap()
5097 iputs = remove_capsnaps(mdsc, inode); in ceph_purge_inode_cap()