Lines Matching refs:ci
77 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_get_snapdir() local
87 ci->i_snap_caps = CEPH_CAP_PIN; /* so we can open */ in ceph_get_snapdir()
88 ci->i_rbytes = 0; in ceph_get_snapdir()
116 static struct ceph_inode_frag *__get_or_create_frag(struct ceph_inode_info *ci, in __get_or_create_frag() argument
124 p = &ci->i_fragtree.rb_node; in __get_or_create_frag()
140 "frag %x\n", &ci->vfs_inode, in __get_or_create_frag()
141 ceph_vinop(&ci->vfs_inode), f); in __get_or_create_frag()
150 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
153 ceph_vinop(&ci->vfs_inode), f); in __get_or_create_frag()
160 struct ceph_inode_frag *__ceph_find_frag(struct ceph_inode_info *ci, u32 f) in __ceph_find_frag() argument
162 struct rb_node *n = ci->i_fragtree.rb_node; in __ceph_find_frag()
183 static u32 __ceph_choose_frag(struct ceph_inode_info *ci, u32 v, in __ceph_choose_frag() argument
196 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
225 u32 ceph_choose_frag(struct ceph_inode_info *ci, u32 v, in ceph_choose_frag() argument
229 mutex_lock(&ci->i_fragtree_mutex); in ceph_choose_frag()
230 ret = __ceph_choose_frag(ci, v, pfrag, found); in ceph_choose_frag()
231 mutex_unlock(&ci->i_fragtree_mutex); in ceph_choose_frag()
243 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_fill_dirfrag() local
252 spin_lock(&ci->i_ceph_lock); in ceph_fill_dirfrag()
253 if (ci->i_auth_cap) in ceph_fill_dirfrag()
254 diri_auth = ci->i_auth_cap->mds; in ceph_fill_dirfrag()
255 spin_unlock(&ci->i_ceph_lock); in ceph_fill_dirfrag()
257 mutex_lock(&ci->i_fragtree_mutex); in ceph_fill_dirfrag()
260 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
267 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
281 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
299 mutex_unlock(&ci->i_fragtree_mutex); in ceph_fill_dirfrag()
307 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_fill_fragtree() local
314 mutex_lock(&ci->i_fragtree_mutex); in ceph_fill_fragtree()
319 if (!__ceph_find_frag(ci, id)) in ceph_fill_fragtree()
321 } else if (!RB_EMPTY_ROOT(&ci->i_fragtree)) { in ceph_fill_fragtree()
322 rb_node = rb_first(&ci->i_fragtree); in ceph_fill_fragtree()
329 if (id != __ceph_choose_frag(ci, id, NULL, NULL)) in ceph_fill_fragtree()
336 rb_node = rb_first(&ci->i_fragtree); in ceph_fill_fragtree()
350 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
355 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
365 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
369 mutex_unlock(&ci->i_fragtree_mutex); in ceph_fill_fragtree()
378 struct ceph_inode_info *ci; in ceph_alloc_inode() local
381 ci = kmem_cache_alloc(ceph_inode_cachep, GFP_NOFS); in ceph_alloc_inode()
382 if (!ci) in ceph_alloc_inode()
385 dout("alloc_inode %p\n", &ci->vfs_inode); in ceph_alloc_inode()
387 spin_lock_init(&ci->i_ceph_lock); in ceph_alloc_inode()
389 ci->i_version = 0; in ceph_alloc_inode()
390 ci->i_inline_version = 0; in ceph_alloc_inode()
391 ci->i_time_warp_seq = 0; in ceph_alloc_inode()
392 ci->i_ceph_flags = 0; in ceph_alloc_inode()
393 ci->i_ordered_count = 0; in ceph_alloc_inode()
394 atomic_set(&ci->i_release_count, 1); in ceph_alloc_inode()
395 atomic_set(&ci->i_complete_count, 0); in ceph_alloc_inode()
396 ci->i_symlink = NULL; in ceph_alloc_inode()
398 memset(&ci->i_dir_layout, 0, sizeof(ci->i_dir_layout)); in ceph_alloc_inode()
400 ci->i_fragtree = RB_ROOT; in ceph_alloc_inode()
401 mutex_init(&ci->i_fragtree_mutex); in ceph_alloc_inode()
403 ci->i_xattrs.blob = NULL; in ceph_alloc_inode()
404 ci->i_xattrs.prealloc_blob = NULL; in ceph_alloc_inode()
405 ci->i_xattrs.dirty = false; in ceph_alloc_inode()
406 ci->i_xattrs.index = RB_ROOT; in ceph_alloc_inode()
407 ci->i_xattrs.count = 0; in ceph_alloc_inode()
408 ci->i_xattrs.names_size = 0; in ceph_alloc_inode()
409 ci->i_xattrs.vals_size = 0; in ceph_alloc_inode()
410 ci->i_xattrs.version = 0; in ceph_alloc_inode()
411 ci->i_xattrs.index_version = 0; in ceph_alloc_inode()
413 ci->i_caps = RB_ROOT; in ceph_alloc_inode()
414 ci->i_auth_cap = NULL; in ceph_alloc_inode()
415 ci->i_dirty_caps = 0; in ceph_alloc_inode()
416 ci->i_flushing_caps = 0; in ceph_alloc_inode()
417 INIT_LIST_HEAD(&ci->i_dirty_item); in ceph_alloc_inode()
418 INIT_LIST_HEAD(&ci->i_flushing_item); in ceph_alloc_inode()
419 ci->i_cap_flush_seq = 0; in ceph_alloc_inode()
420 ci->i_cap_flush_last_tid = 0; in ceph_alloc_inode()
421 memset(&ci->i_cap_flush_tid, 0, sizeof(ci->i_cap_flush_tid)); in ceph_alloc_inode()
422 init_waitqueue_head(&ci->i_cap_wq); in ceph_alloc_inode()
423 ci->i_hold_caps_min = 0; in ceph_alloc_inode()
424 ci->i_hold_caps_max = 0; in ceph_alloc_inode()
425 INIT_LIST_HEAD(&ci->i_cap_delay_list); in ceph_alloc_inode()
426 INIT_LIST_HEAD(&ci->i_cap_snaps); in ceph_alloc_inode()
427 ci->i_head_snapc = NULL; in ceph_alloc_inode()
428 ci->i_snap_caps = 0; in ceph_alloc_inode()
431 ci->i_nr_by_mode[i] = 0; in ceph_alloc_inode()
433 mutex_init(&ci->i_truncate_mutex); in ceph_alloc_inode()
434 ci->i_truncate_seq = 0; in ceph_alloc_inode()
435 ci->i_truncate_size = 0; in ceph_alloc_inode()
436 ci->i_truncate_pending = 0; in ceph_alloc_inode()
438 ci->i_max_size = 0; in ceph_alloc_inode()
439 ci->i_reported_size = 0; in ceph_alloc_inode()
440 ci->i_wanted_max_size = 0; in ceph_alloc_inode()
441 ci->i_requested_max_size = 0; in ceph_alloc_inode()
443 ci->i_pin_ref = 0; in ceph_alloc_inode()
444 ci->i_rd_ref = 0; in ceph_alloc_inode()
445 ci->i_rdcache_ref = 0; in ceph_alloc_inode()
446 ci->i_wr_ref = 0; in ceph_alloc_inode()
447 ci->i_wb_ref = 0; in ceph_alloc_inode()
448 ci->i_wrbuffer_ref = 0; in ceph_alloc_inode()
449 ci->i_wrbuffer_ref_head = 0; in ceph_alloc_inode()
450 ci->i_shared_gen = 0; in ceph_alloc_inode()
451 ci->i_rdcache_gen = 0; in ceph_alloc_inode()
452 ci->i_rdcache_revoking = 0; in ceph_alloc_inode()
454 INIT_LIST_HEAD(&ci->i_unsafe_writes); in ceph_alloc_inode()
455 INIT_LIST_HEAD(&ci->i_unsafe_dirops); in ceph_alloc_inode()
456 spin_lock_init(&ci->i_unsafe_lock); in ceph_alloc_inode()
458 ci->i_snap_realm = NULL; in ceph_alloc_inode()
459 INIT_LIST_HEAD(&ci->i_snap_realm_item); in ceph_alloc_inode()
460 INIT_LIST_HEAD(&ci->i_snap_flush_item); in ceph_alloc_inode()
462 INIT_WORK(&ci->i_wb_work, ceph_writeback_work); in ceph_alloc_inode()
463 INIT_WORK(&ci->i_pg_inv_work, ceph_invalidate_work); in ceph_alloc_inode()
465 INIT_WORK(&ci->i_vmtruncate_work, ceph_vmtruncate_work); in ceph_alloc_inode()
467 ceph_fscache_inode_init(ci); in ceph_alloc_inode()
469 return &ci->vfs_inode; in ceph_alloc_inode()
475 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_i_callback() local
477 kmem_cache_free(ceph_inode_cachep, ci); in ceph_i_callback()
482 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_destroy_inode() local
488 ceph_fscache_unregister_inode_cookie(ci); in ceph_destroy_inode()
496 if (ci->i_snap_realm) { in ceph_destroy_inode()
498 ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; in ceph_destroy_inode()
499 struct ceph_snap_realm *realm = ci->i_snap_realm; in ceph_destroy_inode()
503 list_del_init(&ci->i_snap_realm_item); in ceph_destroy_inode()
508 kfree(ci->i_symlink); in ceph_destroy_inode()
509 while ((n = rb_first(&ci->i_fragtree)) != NULL) { in ceph_destroy_inode()
511 rb_erase(n, &ci->i_fragtree); in ceph_destroy_inode()
515 __ceph_destroy_xattrs(ci); in ceph_destroy_inode()
516 if (ci->i_xattrs.blob) in ceph_destroy_inode()
517 ceph_buffer_put(ci->i_xattrs.blob); in ceph_destroy_inode()
518 if (ci->i_xattrs.prealloc_blob) in ceph_destroy_inode()
519 ceph_buffer_put(ci->i_xattrs.prealloc_blob); in ceph_destroy_inode()
545 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_fill_file_size() local
548 if (ceph_seq_cmp(truncate_seq, ci->i_truncate_seq) > 0 || in ceph_fill_file_size()
549 (truncate_seq == ci->i_truncate_seq && size > inode->i_size)) { in ceph_fill_file_size()
553 ci->i_reported_size = size; in ceph_fill_file_size()
554 if (truncate_seq != ci->i_truncate_seq) { in ceph_fill_file_size()
556 ci->i_truncate_seq, truncate_seq); in ceph_fill_file_size()
557 ci->i_truncate_seq = truncate_seq; in ceph_fill_file_size()
573 __ceph_caps_file_wanted(ci)) { in ceph_fill_file_size()
574 ci->i_truncate_pending++; in ceph_fill_file_size()
579 if (ceph_seq_cmp(truncate_seq, ci->i_truncate_seq) >= 0 && in ceph_fill_file_size()
580 ci->i_truncate_size != truncate_size) { in ceph_fill_file_size()
581 dout("truncate_size %lld -> %llu\n", ci->i_truncate_size, in ceph_fill_file_size()
583 ci->i_truncate_size = truncate_size; in ceph_fill_file_size()
596 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_fill_file_time() local
610 if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) { in ceph_fill_file_time()
616 ci->i_time_warp_seq, (int)time_warp_seq); in ceph_fill_file_time()
620 ci->i_time_warp_seq = time_warp_seq; in ceph_fill_file_time()
621 } else if (time_warp_seq == ci->i_time_warp_seq) { in ceph_fill_file_time()
644 if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) { in ceph_fill_file_time()
648 ci->i_time_warp_seq = time_warp_seq; in ceph_fill_file_time()
655 inode, time_warp_seq, ci->i_time_warp_seq); in ceph_fill_file_time()
671 struct ceph_inode_info *ci = ceph_inode(inode); in fill_inode() local
684 ci->i_version); in fill_inode()
702 spin_lock(&ci->i_ceph_lock); in fill_inode()
715 if (ci->i_version == 0 || in fill_inode()
717 le64_to_cpu(info->version) > (ci->i_version & ~1))) in fill_inode()
720 issued = __ceph_caps_issued(ci, &implemented); in fill_inode()
721 issued |= implemented | __ceph_caps_dirty(ci); in fill_inode()
725 ci->i_version = le64_to_cpu(info->version); in fill_inode()
756 ci->i_layout = info->layout; in fill_inode()
763 ci->i_max_size != le64_to_cpu(info->max_size)) { in fill_inode()
764 dout("max_size %lld -> %llu\n", ci->i_max_size, in fill_inode()
766 ci->i_max_size = le64_to_cpu(info->max_size); in fill_inode()
772 if ((ci->i_xattrs.version == 0 || !(issued & CEPH_CAP_XATTR_EXCL)) && in fill_inode()
773 le64_to_cpu(info->xattr_version) > ci->i_xattrs.version) { in fill_inode()
774 if (ci->i_xattrs.blob) in fill_inode()
775 ceph_buffer_put(ci->i_xattrs.blob); in fill_inode()
776 ci->i_xattrs.blob = xattr_blob; in fill_inode()
778 memcpy(ci->i_xattrs.blob->vec.iov_base, in fill_inode()
780 ci->i_xattrs.version = le64_to_cpu(info->xattr_version); in fill_inode()
801 if (!ci->i_symlink) { in fill_inode()
805 spin_unlock(&ci->i_ceph_lock); in fill_inode()
816 spin_lock(&ci->i_ceph_lock); in fill_inode()
817 if (!ci->i_symlink) in fill_inode()
818 ci->i_symlink = sym; in fill_inode()
827 ci->i_dir_layout = iinfo->dir_layout; in fill_inode()
829 ci->i_files = le64_to_cpu(info->files); in fill_inode()
830 ci->i_subdirs = le64_to_cpu(info->subdirs); in fill_inode()
831 ci->i_rbytes = le64_to_cpu(info->rbytes); in fill_inode()
832 ci->i_rfiles = le64_to_cpu(info->rfiles); in fill_inode()
833 ci->i_rsubdirs = le64_to_cpu(info->rsubdirs); in fill_inode()
834 ceph_decode_timespec(&ci->i_rctime, &info->rctime); in fill_inode()
856 ci->i_files == 0 && ci->i_subdirs == 0 && in fill_inode()
859 !__ceph_dir_is_complete(ci)) { in fill_inode()
861 __ceph_dir_set_complete(ci, in fill_inode()
862 atomic_read(&ci->i_release_count), in fill_inode()
863 ci->i_ordered_count); in fill_inode()
870 ci->i_snap_caps |= le32_to_cpu(info->cap.caps); in fill_inode()
872 __ceph_get_fmode(ci, cap_fmode); in fill_inode()
877 __ceph_get_fmode(ci, cap_fmode); in fill_inode()
881 iinfo->inline_version >= ci->i_inline_version) { in fill_inode()
883 ci->i_inline_version = iinfo->inline_version; in fill_inode()
884 if (ci->i_inline_version != CEPH_INLINE_NONE && in fill_inode()
890 spin_unlock(&ci->i_ceph_lock); in fill_inode()
897 wake_up_all(&ci->i_cap_wq); in fill_inode()
1484 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_inode_set_size() local
1487 spin_lock(&ci->i_ceph_lock); in ceph_inode_set_size()
1493 if ((size << 1) >= ci->i_max_size && in ceph_inode_set_size()
1494 (ci->i_reported_size << 1) < ci->i_max_size) in ceph_inode_set_size()
1497 spin_unlock(&ci->i_ceph_lock); in ceph_inode_set_size()
1519 struct ceph_inode_info *ci = container_of(work, struct ceph_inode_info, in ceph_writeback_work() local
1521 struct inode *inode = &ci->vfs_inode; in ceph_writeback_work()
1549 struct ceph_inode_info *ci = container_of(work, struct ceph_inode_info, in ceph_invalidate_work() local
1551 struct inode *inode = &ci->vfs_inode; in ceph_invalidate_work()
1555 mutex_lock(&ci->i_truncate_mutex); in ceph_invalidate_work()
1556 spin_lock(&ci->i_ceph_lock); in ceph_invalidate_work()
1558 ci->i_rdcache_gen, ci->i_rdcache_revoking); in ceph_invalidate_work()
1559 if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { in ceph_invalidate_work()
1560 if (__ceph_caps_revoking_other(ci, NULL, CEPH_CAP_FILE_CACHE)) in ceph_invalidate_work()
1562 spin_unlock(&ci->i_ceph_lock); in ceph_invalidate_work()
1563 mutex_unlock(&ci->i_truncate_mutex); in ceph_invalidate_work()
1566 orig_gen = ci->i_rdcache_gen; in ceph_invalidate_work()
1567 spin_unlock(&ci->i_ceph_lock); in ceph_invalidate_work()
1571 spin_lock(&ci->i_ceph_lock); in ceph_invalidate_work()
1572 if (orig_gen == ci->i_rdcache_gen && in ceph_invalidate_work()
1573 orig_gen == ci->i_rdcache_revoking) { in ceph_invalidate_work()
1575 ci->i_rdcache_gen); in ceph_invalidate_work()
1576 ci->i_rdcache_revoking--; in ceph_invalidate_work()
1580 inode, orig_gen, ci->i_rdcache_gen, in ceph_invalidate_work()
1581 ci->i_rdcache_revoking); in ceph_invalidate_work()
1582 if (__ceph_caps_revoking_other(ci, NULL, CEPH_CAP_FILE_CACHE)) in ceph_invalidate_work()
1585 spin_unlock(&ci->i_ceph_lock); in ceph_invalidate_work()
1586 mutex_unlock(&ci->i_truncate_mutex); in ceph_invalidate_work()
1589 ceph_check_caps(ci, 0, NULL); in ceph_invalidate_work()
1601 struct ceph_inode_info *ci = container_of(work, struct ceph_inode_info, in ceph_vmtruncate_work() local
1603 struct inode *inode = &ci->vfs_inode; in ceph_vmtruncate_work()
1616 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_queue_vmtruncate() local
1621 &ci->i_vmtruncate_work)) { in ceph_queue_vmtruncate()
1625 inode, ci->i_truncate_pending); in ceph_queue_vmtruncate()
1636 struct ceph_inode_info *ci = ceph_inode(inode); in __ceph_do_pending_vmtruncate() local
1640 mutex_lock(&ci->i_truncate_mutex); in __ceph_do_pending_vmtruncate()
1642 spin_lock(&ci->i_ceph_lock); in __ceph_do_pending_vmtruncate()
1643 if (ci->i_truncate_pending == 0) { in __ceph_do_pending_vmtruncate()
1645 spin_unlock(&ci->i_ceph_lock); in __ceph_do_pending_vmtruncate()
1646 mutex_unlock(&ci->i_truncate_mutex); in __ceph_do_pending_vmtruncate()
1654 if (ci->i_wrbuffer_ref_head < ci->i_wrbuffer_ref) { in __ceph_do_pending_vmtruncate()
1657 spin_unlock(&ci->i_ceph_lock); in __ceph_do_pending_vmtruncate()
1664 WARN_ON_ONCE(ci->i_rd_ref || ci->i_wr_ref); in __ceph_do_pending_vmtruncate()
1666 to = ci->i_truncate_size; in __ceph_do_pending_vmtruncate()
1667 wrbuffer_refs = ci->i_wrbuffer_ref; in __ceph_do_pending_vmtruncate()
1669 ci->i_truncate_pending, to); in __ceph_do_pending_vmtruncate()
1670 spin_unlock(&ci->i_ceph_lock); in __ceph_do_pending_vmtruncate()
1674 spin_lock(&ci->i_ceph_lock); in __ceph_do_pending_vmtruncate()
1675 if (to == ci->i_truncate_size) { in __ceph_do_pending_vmtruncate()
1676 ci->i_truncate_pending = 0; in __ceph_do_pending_vmtruncate()
1679 spin_unlock(&ci->i_ceph_lock); in __ceph_do_pending_vmtruncate()
1683 mutex_unlock(&ci->i_truncate_mutex); in __ceph_do_pending_vmtruncate()
1686 ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); in __ceph_do_pending_vmtruncate()
1688 wake_up_all(&ci->i_cap_wq); in __ceph_do_pending_vmtruncate()
1696 struct ceph_inode_info *ci = ceph_inode(d_inode(dentry)); in ceph_sym_follow_link() local
1697 nd_set_link(nd, ci->i_symlink); in ceph_sym_follow_link()
1718 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_setattr() local
1740 spin_lock(&ci->i_ceph_lock); in ceph_setattr()
1741 issued = __ceph_caps_issued(ci, NULL); in ceph_setattr()
1794 ci->i_time_warp_seq++; in ceph_setattr()
1816 ci->i_time_warp_seq++; in ceph_setattr()
1842 ci->i_reported_size = attr->ia_size; in ceph_setattr()
1884 inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied); in ceph_setattr()
1889 spin_unlock(&ci->i_ceph_lock); in ceph_setattr()
1994 struct ceph_inode_info *ci = ceph_inode(inode); in ceph_getattr() local
2008 stat->size = ci->i_rbytes; in ceph_getattr()
2010 stat->size = ci->i_files + ci->i_subdirs; in ceph_getattr()