Lines Matching refs:mdsc

48 static u64 __get_oldest_flush_tid(struct ceph_mds_client *mdsc);
49 static void __kick_flushing_caps(struct ceph_mds_client *mdsc,
130 void ceph_caps_init(struct ceph_mds_client *mdsc) in ceph_caps_init() argument
132 INIT_LIST_HEAD(&mdsc->caps_list); in ceph_caps_init()
133 spin_lock_init(&mdsc->caps_list_lock); in ceph_caps_init()
136 void ceph_caps_finalize(struct ceph_mds_client *mdsc) in ceph_caps_finalize() argument
140 spin_lock(&mdsc->caps_list_lock); in ceph_caps_finalize()
141 while (!list_empty(&mdsc->caps_list)) { in ceph_caps_finalize()
142 cap = list_first_entry(&mdsc->caps_list, in ceph_caps_finalize()
147 mdsc->caps_total_count = 0; in ceph_caps_finalize()
148 mdsc->caps_avail_count = 0; in ceph_caps_finalize()
149 mdsc->caps_use_count = 0; in ceph_caps_finalize()
150 mdsc->caps_reserve_count = 0; in ceph_caps_finalize()
151 mdsc->caps_min_count = 0; in ceph_caps_finalize()
152 spin_unlock(&mdsc->caps_list_lock); in ceph_caps_finalize()
155 void ceph_adjust_caps_max_min(struct ceph_mds_client *mdsc, in ceph_adjust_caps_max_min() argument
158 spin_lock(&mdsc->caps_list_lock); in ceph_adjust_caps_max_min()
159 mdsc->caps_min_count = fsopt->max_readdir; in ceph_adjust_caps_max_min()
160 if (mdsc->caps_min_count < 1024) in ceph_adjust_caps_max_min()
161 mdsc->caps_min_count = 1024; in ceph_adjust_caps_max_min()
162 mdsc->caps_use_max = fsopt->caps_max; in ceph_adjust_caps_max_min()
163 if (mdsc->caps_use_max > 0 && in ceph_adjust_caps_max_min()
164 mdsc->caps_use_max < mdsc->caps_min_count) in ceph_adjust_caps_max_min()
165 mdsc->caps_use_max = mdsc->caps_min_count; in ceph_adjust_caps_max_min()
166 spin_unlock(&mdsc->caps_list_lock); in ceph_adjust_caps_max_min()
169 static void __ceph_unreserve_caps(struct ceph_mds_client *mdsc, int nr_caps) in __ceph_unreserve_caps() argument
175 BUG_ON(mdsc->caps_reserve_count < nr_caps); in __ceph_unreserve_caps()
176 mdsc->caps_reserve_count -= nr_caps; in __ceph_unreserve_caps()
177 if (mdsc->caps_avail_count >= in __ceph_unreserve_caps()
178 mdsc->caps_reserve_count + mdsc->caps_min_count) { in __ceph_unreserve_caps()
179 mdsc->caps_total_count -= nr_caps; in __ceph_unreserve_caps()
181 cap = list_first_entry(&mdsc->caps_list, in __ceph_unreserve_caps()
187 mdsc->caps_avail_count += nr_caps; in __ceph_unreserve_caps()
190 doutc(mdsc->fsc->client, in __ceph_unreserve_caps()
192 mdsc->caps_total_count, mdsc->caps_use_count, in __ceph_unreserve_caps()
193 mdsc->caps_reserve_count, mdsc->caps_avail_count); in __ceph_unreserve_caps()
194 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in __ceph_unreserve_caps()
195 mdsc->caps_reserve_count + in __ceph_unreserve_caps()
196 mdsc->caps_avail_count); in __ceph_unreserve_caps()
203 int ceph_reserve_caps(struct ceph_mds_client *mdsc, in ceph_reserve_caps() argument
206 struct ceph_client *cl = mdsc->fsc->client; in ceph_reserve_caps()
220 spin_lock(&mdsc->caps_list_lock); in ceph_reserve_caps()
221 if (mdsc->caps_avail_count >= need) in ceph_reserve_caps()
224 have = mdsc->caps_avail_count; in ceph_reserve_caps()
225 mdsc->caps_avail_count -= have; in ceph_reserve_caps()
226 mdsc->caps_reserve_count += have; in ceph_reserve_caps()
227 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_reserve_caps()
228 mdsc->caps_reserve_count + in ceph_reserve_caps()
229 mdsc->caps_avail_count); in ceph_reserve_caps()
230 spin_unlock(&mdsc->caps_list_lock); in ceph_reserve_caps()
242 for (j = 0; j < mdsc->max_sessions; j++) { in ceph_reserve_caps()
243 s = __ceph_lookup_mds_session(mdsc, j); in ceph_reserve_caps()
246 mutex_unlock(&mdsc->mutex); in ceph_reserve_caps()
250 ceph_trim_caps(mdsc, s, max_caps); in ceph_reserve_caps()
254 mutex_lock(&mdsc->mutex); in ceph_reserve_caps()
258 spin_lock(&mdsc->caps_list_lock); in ceph_reserve_caps()
259 if (mdsc->caps_avail_count) { in ceph_reserve_caps()
261 if (mdsc->caps_avail_count >= need - i) in ceph_reserve_caps()
264 more_have = mdsc->caps_avail_count; in ceph_reserve_caps()
268 mdsc->caps_avail_count -= more_have; in ceph_reserve_caps()
269 mdsc->caps_reserve_count += more_have; in ceph_reserve_caps()
272 spin_unlock(&mdsc->caps_list_lock); in ceph_reserve_caps()
289 spin_lock(&mdsc->caps_list_lock); in ceph_reserve_caps()
290 mdsc->caps_total_count += alloc; in ceph_reserve_caps()
291 mdsc->caps_reserve_count += alloc; in ceph_reserve_caps()
292 list_splice(&newcaps, &mdsc->caps_list); in ceph_reserve_caps()
294 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_reserve_caps()
295 mdsc->caps_reserve_count + in ceph_reserve_caps()
296 mdsc->caps_avail_count); in ceph_reserve_caps()
299 __ceph_unreserve_caps(mdsc, have + alloc); in ceph_reserve_caps()
301 spin_unlock(&mdsc->caps_list_lock); in ceph_reserve_caps()
304 mdsc->caps_total_count, mdsc->caps_use_count, in ceph_reserve_caps()
305 mdsc->caps_reserve_count, mdsc->caps_avail_count); in ceph_reserve_caps()
309 void ceph_unreserve_caps(struct ceph_mds_client *mdsc, in ceph_unreserve_caps() argument
312 struct ceph_client *cl = mdsc->fsc->client; in ceph_unreserve_caps()
318 spin_lock(&mdsc->caps_list_lock); in ceph_unreserve_caps()
319 __ceph_unreserve_caps(mdsc, ctx->count); in ceph_unreserve_caps()
322 if (mdsc->caps_use_max > 0 && in ceph_unreserve_caps()
323 mdsc->caps_use_count > mdsc->caps_use_max) in ceph_unreserve_caps()
325 spin_unlock(&mdsc->caps_list_lock); in ceph_unreserve_caps()
328 ceph_reclaim_caps_nr(mdsc, ctx->used); in ceph_unreserve_caps()
331 struct ceph_cap *ceph_get_cap(struct ceph_mds_client *mdsc, in ceph_get_cap() argument
334 struct ceph_client *cl = mdsc->fsc->client; in ceph_get_cap()
341 spin_lock(&mdsc->caps_list_lock); in ceph_get_cap()
342 mdsc->caps_use_count++; in ceph_get_cap()
343 mdsc->caps_total_count++; in ceph_get_cap()
344 spin_unlock(&mdsc->caps_list_lock); in ceph_get_cap()
346 spin_lock(&mdsc->caps_list_lock); in ceph_get_cap()
347 if (mdsc->caps_avail_count) { in ceph_get_cap()
348 BUG_ON(list_empty(&mdsc->caps_list)); in ceph_get_cap()
350 mdsc->caps_avail_count--; in ceph_get_cap()
351 mdsc->caps_use_count++; in ceph_get_cap()
352 cap = list_first_entry(&mdsc->caps_list, in ceph_get_cap()
356 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_get_cap()
357 mdsc->caps_reserve_count + mdsc->caps_avail_count); in ceph_get_cap()
359 spin_unlock(&mdsc->caps_list_lock); in ceph_get_cap()
365 spin_lock(&mdsc->caps_list_lock); in ceph_get_cap()
367 ctx->count, mdsc->caps_total_count, mdsc->caps_use_count, in ceph_get_cap()
368 mdsc->caps_reserve_count, mdsc->caps_avail_count); in ceph_get_cap()
370 BUG_ON(ctx->count > mdsc->caps_reserve_count); in ceph_get_cap()
371 BUG_ON(list_empty(&mdsc->caps_list)); in ceph_get_cap()
375 mdsc->caps_reserve_count--; in ceph_get_cap()
376 mdsc->caps_use_count++; in ceph_get_cap()
378 cap = list_first_entry(&mdsc->caps_list, struct ceph_cap, caps_item); in ceph_get_cap()
381 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_get_cap()
382 mdsc->caps_reserve_count + mdsc->caps_avail_count); in ceph_get_cap()
383 spin_unlock(&mdsc->caps_list_lock); in ceph_get_cap()
387 void ceph_put_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap) in ceph_put_cap() argument
389 struct ceph_client *cl = mdsc->fsc->client; in ceph_put_cap()
391 spin_lock(&mdsc->caps_list_lock); in ceph_put_cap()
393 mdsc->caps_total_count, mdsc->caps_use_count, in ceph_put_cap()
394 mdsc->caps_reserve_count, mdsc->caps_avail_count); in ceph_put_cap()
395 mdsc->caps_use_count--; in ceph_put_cap()
400 if (mdsc->caps_avail_count >= mdsc->caps_reserve_count + in ceph_put_cap()
401 mdsc->caps_min_count) { in ceph_put_cap()
402 mdsc->caps_total_count--; in ceph_put_cap()
405 mdsc->caps_avail_count++; in ceph_put_cap()
406 list_add(&cap->caps_item, &mdsc->caps_list); in ceph_put_cap()
409 BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count + in ceph_put_cap()
410 mdsc->caps_reserve_count + mdsc->caps_avail_count); in ceph_put_cap()
411 spin_unlock(&mdsc->caps_list_lock); in ceph_put_cap()
418 struct ceph_mds_client *mdsc = fsc->mdsc; in ceph_reservation_status() local
420 spin_lock(&mdsc->caps_list_lock); in ceph_reservation_status()
423 *total = mdsc->caps_total_count; in ceph_reservation_status()
425 *avail = mdsc->caps_avail_count; in ceph_reservation_status()
427 *used = mdsc->caps_use_count; in ceph_reservation_status()
429 *reserved = mdsc->caps_reserve_count; in ceph_reservation_status()
431 *min = mdsc->caps_min_count; in ceph_reservation_status()
433 spin_unlock(&mdsc->caps_list_lock); in ceph_reservation_status()
497 static void __cap_set_timeouts(struct ceph_mds_client *mdsc, in __cap_set_timeouts() argument
501 struct ceph_mount_options *opt = mdsc->fsc->mount_options; in __cap_set_timeouts()
505 doutc(mdsc->fsc->client, "%p %llx.%llx %lu\n", inode, in __cap_set_timeouts()
517 static void __cap_delay_requeue(struct ceph_mds_client *mdsc, in __cap_delay_requeue() argument
522 doutc(mdsc->fsc->client, "%p %llx.%llx flags 0x%lx at %lu\n", in __cap_delay_requeue()
525 if (!mdsc->stopping) { in __cap_delay_requeue()
526 spin_lock(&mdsc->cap_delay_lock); in __cap_delay_requeue()
532 __cap_set_timeouts(mdsc, ci); in __cap_delay_requeue()
533 list_add_tail(&ci->i_cap_delay_list, &mdsc->cap_delay_list); in __cap_delay_requeue()
535 spin_unlock(&mdsc->cap_delay_lock); in __cap_delay_requeue()
544 static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc, in __cap_delay_requeue_front() argument
549 doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, ceph_vinop(inode)); in __cap_delay_requeue_front()
550 spin_lock(&mdsc->cap_delay_lock); in __cap_delay_requeue_front()
554 list_add(&ci->i_cap_delay_list, &mdsc->cap_delay_list); in __cap_delay_requeue_front()
555 spin_unlock(&mdsc->cap_delay_lock); in __cap_delay_requeue_front()
563 static void __cap_delay_cancel(struct ceph_mds_client *mdsc, in __cap_delay_cancel() argument
568 doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, ceph_vinop(inode)); in __cap_delay_cancel()
571 spin_lock(&mdsc->cap_delay_lock); in __cap_delay_cancel()
573 spin_unlock(&mdsc->cap_delay_lock); in __cap_delay_cancel()
656 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in ceph_add_cap() local
691 atomic64_inc(&mdsc->metric.total_caps); in ceph_add_cap()
726 struct ceph_snap_realm *realm = ceph_lookup_snap_realm(mdsc, in ceph_add_cap()
749 __cap_delay_requeue(mdsc, ci); in ceph_add_cap()
957 ceph_update_cap_hit(&fsc->mdsc->metric); in __ceph_caps_issued_mask_metric()
959 ceph_update_cap_mis(&fsc->mdsc->metric); in __ceph_caps_issued_mask_metric()
1127 struct ceph_mds_client *mdsc; in __ceph_remove_cap() local
1140 mdsc = ceph_inode_to_fs_client(&ci->netfs.inode)->mdsc; in __ceph_remove_cap()
1156 atomic64_dec(&mdsc->metric.total_caps); in __ceph_remove_cap()
1183 ceph_put_cap(mdsc, cap); in __ceph_remove_cap()
1193 __cap_delay_cancel(mdsc, ci); in __ceph_remove_cap()
1197 void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, in ceph_remove_cap() argument
1205 doutc(mdsc->fsc->client, "inode is NULL\n"); in ceph_remove_cap()
1247 struct ceph_mds_client *mdsc = arg->session->s_mdsc; in encode_cap_msg() local
1248 struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc; in encode_cap_msg()
1250 doutc(mdsc->fsc->client, in encode_cap_msg()
1367 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in __ceph_remove_caps() local
1377 ceph_remove_cap(mdsc, cap, true); in __ceph_remove_caps()
1622 struct ceph_mds_client *mdsc = session->s_mdsc; in __ceph_flush_snaps() local
1623 struct ceph_client *cl = mdsc->fsc->client; in __ceph_flush_snaps()
1648 spin_lock(&mdsc->cap_dirty_lock); in __ceph_flush_snaps()
1649 capsnap->cap_flush.tid = ++mdsc->last_cap_flush_tid; in __ceph_flush_snaps()
1651 &mdsc->cap_flush_list); in __ceph_flush_snaps()
1653 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in __ceph_flush_snaps()
1658 spin_unlock(&mdsc->cap_dirty_lock); in __ceph_flush_snaps()
1720 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in ceph_flush_snaps() local
1748 mutex_lock(&mdsc->mutex); in ceph_flush_snaps()
1749 session = __ceph_lookup_mds_session(mdsc, mds); in ceph_flush_snaps()
1750 mutex_unlock(&mdsc->mutex); in ceph_flush_snaps()
1756 __kick_flushing_caps(mdsc, session, ci, 0); in ceph_flush_snaps()
1767 spin_lock(&mdsc->snap_flush_lock); in ceph_flush_snaps()
1771 spin_unlock(&mdsc->snap_flush_lock); in ceph_flush_snaps()
1785 struct ceph_mds_client *mdsc = in __ceph_mark_dirty_caps() local
1786 ceph_sb_to_fs_client(ci->netfs.inode.i_sb)->mdsc; in __ceph_mark_dirty_caps()
1813 WARN_ON_ONCE(!rwsem_is_locked(&mdsc->snap_rwsem)); in __ceph_mark_dirty_caps()
1821 spin_lock(&mdsc->cap_dirty_lock); in __ceph_mark_dirty_caps()
1823 spin_unlock(&mdsc->cap_dirty_lock); in __ceph_mark_dirty_caps()
1835 __cap_delay_requeue(mdsc, ci); in __ceph_mark_dirty_caps()
1857 static u64 __get_oldest_flush_tid(struct ceph_mds_client *mdsc) in __get_oldest_flush_tid() argument
1859 if (!list_empty(&mdsc->cap_flush_list)) { in __get_oldest_flush_tid()
1861 list_first_entry(&mdsc->cap_flush_list, in __get_oldest_flush_tid()
1872 static bool __detach_cap_flush_from_mdsc(struct ceph_mds_client *mdsc, in __detach_cap_flush_from_mdsc() argument
1878 if (wake && cf->g_list.prev != &mdsc->cap_flush_list) { in __detach_cap_flush_from_mdsc()
1912 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in __mark_caps_flushing() local
1936 spin_lock(&mdsc->cap_dirty_lock); in __mark_caps_flushing()
1939 cf->tid = ++mdsc->last_cap_flush_tid; in __mark_caps_flushing()
1940 list_add_tail(&cf->g_list, &mdsc->cap_flush_list); in __mark_caps_flushing()
1941 *oldest_flush_tid = __get_oldest_flush_tid(mdsc); in __mark_caps_flushing()
1945 mdsc->num_cap_flushing++; in __mark_caps_flushing()
1947 spin_unlock(&mdsc->cap_dirty_lock); in __mark_caps_flushing()
2012 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb); in ceph_check_caps() local
2057 if (!mdsc->stopping && inode->i_nlink > 0) { in ceph_check_caps()
2105 if ((!(flags & CHECK_CAPS_NOINVAL) || mdsc->stopping) && in ceph_check_caps()
2227 __kick_flushing_caps(mdsc, session, ci, 0); in ceph_check_caps()
2244 spin_lock(&mdsc->cap_dirty_lock); in ceph_check_caps()
2245 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_check_caps()
2246 spin_unlock(&mdsc->cap_dirty_lock); in ceph_check_caps()
2266 __cap_delay_requeue(mdsc, ci); in ceph_check_caps()
2283 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in try_flush_caps() local
2303 __kick_flushing_caps(mdsc, session, ci, 0); in try_flush_caps()
2361 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in flush_mdlog_and_wait_inode_unsafe_requests() local
2394 mutex_lock(&mdsc->mutex); in flush_mdlog_and_wait_inode_unsafe_requests()
2395 max_sessions = mdsc->max_sessions; in flush_mdlog_and_wait_inode_unsafe_requests()
2399 mutex_unlock(&mdsc->mutex); in flush_mdlog_and_wait_inode_unsafe_requests()
2439 mutex_unlock(&mdsc->mutex); in flush_mdlog_and_wait_inode_unsafe_requests()
2549 struct ceph_mds_client *mdsc = in ceph_write_inode() local
2550 ceph_sb_to_fs_client(inode->i_sb)->mdsc; in ceph_write_inode()
2554 __cap_delay_requeue_front(mdsc, ci); in ceph_write_inode()
2560 static void __kick_flushing_caps(struct ceph_mds_client *mdsc, in __kick_flushing_caps() argument
2568 struct ceph_client *cl = mdsc->fsc->client; in __kick_flushing_caps()
2643 void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, in ceph_early_kick_flushing_caps() argument
2646 struct ceph_client *cl = mdsc->fsc->client; in ceph_early_kick_flushing_caps()
2653 spin_lock(&mdsc->cap_dirty_lock); in ceph_early_kick_flushing_caps()
2654 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_early_kick_flushing_caps()
2655 spin_unlock(&mdsc->cap_dirty_lock); in ceph_early_kick_flushing_caps()
2685 __kick_flushing_caps(mdsc, session, ci, in ceph_early_kick_flushing_caps()
2695 void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, in ceph_kick_flushing_caps() argument
2698 struct ceph_client *cl = mdsc->fsc->client; in ceph_kick_flushing_caps()
2707 spin_lock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_caps()
2708 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_kick_flushing_caps()
2709 spin_unlock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_caps()
2724 __kick_flushing_caps(mdsc, session, ci, in ceph_kick_flushing_caps()
2734 struct ceph_mds_client *mdsc = session->s_mdsc; in ceph_kick_flushing_inode_caps() local
2740 doutc(mdsc->fsc->client, "%p %llx.%llx flushing %s\n", in ceph_kick_flushing_inode_caps()
2746 spin_lock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_inode_caps()
2749 oldest_flush_tid = __get_oldest_flush_tid(mdsc); in ceph_kick_flushing_inode_caps()
2750 spin_unlock(&mdsc->cap_dirty_lock); in ceph_kick_flushing_inode_caps()
2752 __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); in ceph_kick_flushing_inode_caps()
2817 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in try_get_cap_refs() local
2842 up_read(&mdsc->snap_rwsem); in try_get_cap_refs()
2890 if (!down_read_trylock(&mdsc->snap_rwsem)) { in try_get_cap_refs()
2901 down_read(&mdsc->snap_rwsem); in try_get_cap_refs()
2953 __ceph_touch_fmode(ci, mdsc, flags); in try_get_cap_refs()
2957 up_read(&mdsc->snap_rwsem); in try_get_cap_refs()
2960 ceph_update_cap_mis(&mdsc->metric); in try_get_cap_refs()
2962 ceph_update_cap_hit(&mdsc->metric); in try_get_cap_refs()
3066 struct ceph_mds_client *mdsc = fsc->mdsc; in __ceph_get_caps() local
3077 spin_lock(&mdsc->caps_list_lock); in __ceph_get_caps()
3078 list_add(&cw.list, &mdsc->cap_wait_list); in __ceph_get_caps()
3079 spin_unlock(&mdsc->caps_list_lock); in __ceph_get_caps()
3100 spin_lock(&mdsc->caps_list_lock); in __ceph_get_caps()
3102 spin_unlock(&mdsc->caps_list_lock); in __ceph_get_caps()
3817 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in handle_cap_flush_ack() local
3818 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_flush_ack()
3866 spin_lock(&mdsc->cap_dirty_lock); in handle_cap_flush_ack()
3869 wake_mdsc |= __detach_cap_flush_from_mdsc(mdsc, cf); in handle_cap_flush_ack()
3883 mdsc->num_cap_flushing--; in handle_cap_flush_ack()
3902 spin_unlock(&mdsc->cap_dirty_lock); in handle_cap_flush_ack()
3918 wake_up_all(&mdsc->cap_flushing_wq); in handle_cap_flush_ack()
3927 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in __ceph_remove_capsnap() local
3928 struct ceph_client *cl = mdsc->fsc->client; in __ceph_remove_capsnap()
3941 spin_lock(&mdsc->cap_dirty_lock); in __ceph_remove_capsnap()
3945 ret = __detach_cap_flush_from_mdsc(mdsc, &capsnap->cap_flush); in __ceph_remove_capsnap()
3948 spin_unlock(&mdsc->cap_dirty_lock); in __ceph_remove_capsnap()
3973 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc; in handle_cap_flushsnap_ack() local
3974 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_flushsnap_ack()
4010 wake_up_all(&mdsc->cap_flushing_wq); in handle_cap_flushsnap_ack()
4068 struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc; in handle_cap_export() local
4069 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_export()
4091 down_read(&mdsc->snap_rwsem); in handle_cap_export()
4098 ceph_remove_cap(mdsc, cap, false); in handle_cap_export()
4135 ceph_remove_cap(mdsc, cap, false); in handle_cap_export()
4146 spin_lock(&mdsc->cap_dirty_lock); in handle_cap_export()
4149 spin_unlock(&mdsc->cap_dirty_lock); in handle_cap_export()
4152 ceph_remove_cap(mdsc, cap, false); in handle_cap_export()
4157 up_read(&mdsc->snap_rwsem); in handle_cap_export()
4161 tsession = ceph_mdsc_open_export_target_session(mdsc, target); in handle_cap_export()
4172 new_cap = ceph_get_cap(mdsc, NULL); in handle_cap_export()
4183 up_read(&mdsc->snap_rwsem); in handle_cap_export()
4190 ceph_put_cap(mdsc, new_cap); in handle_cap_export()
4198 static void handle_cap_import(struct ceph_mds_client *mdsc, in handle_cap_import() argument
4205 struct ceph_client *cl = mdsc->fsc->client; in handle_cap_import()
4237 new_cap = ceph_get_cap(mdsc, NULL); in handle_cap_import()
4244 ceph_put_cap(mdsc, new_cap); in handle_cap_import()
4268 ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE)); in handle_cap_import()
4330 struct ceph_mds_client *mdsc = session->s_mdsc; in ceph_handle_caps() local
4331 struct ceph_client *cl = mdsc->fsc->client; in ceph_handle_caps()
4350 if (!ceph_inc_mds_stopping_blocker(mdsc, session)) in ceph_handle_caps()
4399 struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc; in ceph_handle_caps()
4450 inode = ceph_find_inode(mdsc->fsc->sb, vino); in ceph_handle_caps()
4487 down_write(&mdsc->snap_rwsem); in ceph_handle_caps()
4488 if (ceph_update_snap_trace(mdsc, snaptrace, in ceph_handle_caps()
4491 up_write(&mdsc->snap_rwsem); in ceph_handle_caps()
4495 downgrade_write(&mdsc->snap_rwsem); in ceph_handle_caps()
4497 down_read(&mdsc->snap_rwsem); in ceph_handle_caps()
4500 handle_cap_import(mdsc, inode, h, peer, session, in ceph_handle_caps()
4505 ceph_put_snap_realm(mdsc, realm); in ceph_handle_caps()
4562 ceph_dec_mds_stopping_blocker(mdsc); in ceph_handle_caps()
4568 ceph_mdsc_close_sessions(mdsc); in ceph_handle_caps()
4580 cap = ceph_get_cap(mdsc, NULL); in ceph_handle_caps()
4591 ceph_flush_session_cap_releases(mdsc, session); in ceph_handle_caps()
4607 unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc) in ceph_check_delayed_caps() argument
4609 struct ceph_client *cl = mdsc->fsc->client; in ceph_check_delayed_caps()
4612 struct ceph_mount_options *opt = mdsc->fsc->mount_options; in ceph_check_delayed_caps()
4618 spin_lock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4619 while (!list_empty(&mdsc->cap_delay_list)) { in ceph_check_delayed_caps()
4620 ci = list_first_entry(&mdsc->cap_delay_list, in ceph_check_delayed_caps()
4635 spin_unlock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4640 spin_lock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4651 spin_unlock(&mdsc->cap_delay_lock); in ceph_check_delayed_caps()
4662 struct ceph_mds_client *mdsc = s->s_mdsc; in flush_dirty_session_caps() local
4663 struct ceph_client *cl = mdsc->fsc->client; in flush_dirty_session_caps()
4668 spin_lock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4675 spin_unlock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4679 spin_lock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4681 spin_unlock(&mdsc->cap_dirty_lock); in flush_dirty_session_caps()
4685 void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc) in ceph_flush_dirty_caps() argument
4687 ceph_mdsc_iterate_sessions(mdsc, flush_dirty_session_caps, true); in ceph_flush_dirty_caps()
4695 struct ceph_mds_client *mdsc = s->s_mdsc; in flush_cap_releases() local
4696 struct ceph_client *cl = mdsc->fsc->client; in flush_cap_releases()
4701 ceph_flush_session_cap_releases(mdsc, s); in flush_cap_releases()
4707 void ceph_flush_cap_releases(struct ceph_mds_client *mdsc) in ceph_flush_cap_releases() argument
4709 ceph_mdsc_iterate_sessions(mdsc, flush_cap_releases, true); in ceph_flush_cap_releases()
4713 struct ceph_mds_client *mdsc, int fmode) in __ceph_touch_fmode() argument
4724 __cap_delay_requeue(mdsc, ci); in __ceph_touch_fmode()
4729 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->netfs.inode.i_sb); in ceph_get_fmode() local
4735 atomic64_inc(&mdsc->metric.opened_files); in ceph_get_fmode()
4752 percpu_counter_inc(&mdsc->metric.opened_inodes); in ceph_get_fmode()
4763 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->netfs.inode.i_sb); in ceph_put_fmode() local
4769 atomic64_dec(&mdsc->metric.opened_files); in ceph_put_fmode()
4788 percpu_counter_dec(&mdsc->metric.opened_inodes); in ceph_put_fmode()
4808 struct ceph_mds_client *mdsc = in ceph_drop_caps_for_unlink() local
4809 ceph_inode_to_fs_client(inode)->mdsc; in ceph_drop_caps_for_unlink()
4811 doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, in ceph_drop_caps_for_unlink()
4813 spin_lock(&mdsc->cap_delay_lock); in ceph_drop_caps_for_unlink()
4818 &mdsc->cap_unlink_delay_list); in ceph_drop_caps_for_unlink()
4819 spin_unlock(&mdsc->cap_delay_lock); in ceph_drop_caps_for_unlink()
4825 ceph_queue_cap_unlink_work(mdsc); in ceph_drop_caps_for_unlink()
4980 static int remove_capsnaps(struct ceph_mds_client *mdsc, struct inode *inode) in remove_capsnaps() argument
4983 struct ceph_client *cl = mdsc->fsc->client; in remove_capsnaps()
5001 wake_up_all(&mdsc->cap_flushing_wq); in remove_capsnaps()
5008 struct ceph_mds_client *mdsc = fsc->mdsc; in ceph_purge_inode_cap() local
5032 spin_lock(&mdsc->cap_dirty_lock); in ceph_purge_inode_cap()
5060 mdsc->num_cap_flushing--; in ceph_purge_inode_cap()
5063 spin_unlock(&mdsc->cap_dirty_lock); in ceph_purge_inode_cap()
5093 iputs = remove_capsnaps(mdsc, inode); in ceph_purge_inode_cap()