Lines Matching refs:cfn
931 struct cache_file_node *cfn = NULL; in update_inode_to_dentry() local
943 cfn = find_cfn(sbi, HMDFS_SERVER_CID, relative_path, true); in update_inode_to_dentry()
944 if (!cfn) in update_inode_to_dentry()
948 cfn->filp); in update_inode_to_dentry()
961 write_dentry_page(cfn->filp, ctx.page, in update_inode_to_dentry()
963 hmdfs_unlock_file(cfn->filp, ipos, DENTRYGROUP_SIZE); in update_inode_to_dentry()
966 release_cfn(cfn); in update_inode_to_dentry()
1167 static void free_cfn(struct cache_file_node *cfn) in free_cfn() argument
1169 if (!IS_ERR_OR_NULL(cfn->filp)) in free_cfn()
1170 filp_close(cfn->filp, NULL); in free_cfn()
1172 kfree(cfn->relative_path); in free_cfn()
1173 kfree(cfn); in free_cfn()
1176 static bool dentry_file_match(struct cache_file_node *cfn, const char *id, in dentry_file_match() argument
1181 if (cfn->sbi->s_case_sensitive) in dentry_file_match()
1182 ret = strcmp(cfn->relative_path, path); in dentry_file_match()
1184 ret = strcasecmp(cfn->relative_path, path); in dentry_file_match()
1186 return (!ret && !strncmp((cfn)->cid, id, HMDFS_CFN_CID_SIZE - 1)); in dentry_file_match()
1192 struct cache_file_node *cfn = NULL; in __find_cfn() local
1195 list_for_each_entry(cfn, head, list) { in __find_cfn()
1196 if (dentry_file_match(cfn, cid, path)) { in __find_cfn()
1197 refcount_inc(&cfn->ref); in __find_cfn()
1198 return cfn; in __find_cfn()
1207 struct cache_file_node *cfn = kzalloc(sizeof(*cfn), GFP_KERNEL); in create_cfn() local
1209 if (!cfn) in create_cfn()
1212 cfn->relative_path = kstrdup(path, GFP_KERNEL); in create_cfn()
1213 if (!cfn->relative_path) in create_cfn()
1216 refcount_set(&cfn->ref, 1); in create_cfn()
1217 strncpy(cfn->cid, cid, HMDFS_CFN_CID_SIZE - 1); in create_cfn()
1218 cfn->cid[HMDFS_CFN_CID_SIZE - 1] = '\0'; in create_cfn()
1219 cfn->sbi = sbi; in create_cfn()
1220 cfn->server = server; in create_cfn()
1221 return cfn; in create_cfn()
1223 free_cfn(cfn); in create_cfn()
1231 struct cache_file_node *cfn = NULL; in insert_cfn() local
1236 cfn = create_cfn(sbi, path, cid, server); in insert_cfn()
1237 if (!cfn) in insert_cfn()
1253 cfn->filp = filp; in insert_cfn()
1254 list_add_tail(&cfn->list, head); in insert_cfn()
1265 free_cfn(cfn); in insert_cfn()
1307 struct cache_file_node *cfn = NULL; in cache_file_persistent() local
1318 cfn = find_cfn(con->sbi, cid, relative_path, server); in cache_file_persistent()
1319 if (cfn) { in cache_file_persistent()
1320 release_cfn(cfn); in cache_file_persistent()
1364 struct cache_file_node *cfn = NULL; in __destroy_cfn() local
1367 list_for_each_entry_safe(cfn, n, head, list) { in __destroy_cfn()
1368 list_del_init(&cfn->list); in __destroy_cfn()
1369 release_cfn(cfn); in __destroy_cfn()
1384 struct cache_file_node *cfn = NULL; in find_cfn() local
1387 cfn = __find_cfn(sbi, cid, path, server); in find_cfn()
1389 return cfn; in find_cfn()
1392 void release_cfn(struct cache_file_node *cfn) in release_cfn() argument
1394 if (refcount_dec_and_test(&cfn->ref)) in release_cfn()
1395 free_cfn(cfn); in release_cfn()
1398 void remove_cfn(struct cache_file_node *cfn) in remove_cfn() argument
1400 struct hmdfs_sb_info *sbi = cfn->sbi; in remove_cfn()
1404 deleted = list_empty(&cfn->list); in remove_cfn()
1406 list_del_init(&cfn->list); in remove_cfn()
1409 delete_dentry_file(cfn->filp); in remove_cfn()
1410 release_cfn(cfn); in remove_cfn()
1549 void add_to_delete_list(struct hmdfs_sb_info *sbi, struct cache_file_node *cfn) in add_to_delete_list() argument
1552 list_add_tail(&cfn->list, &sbi->to_delete); in add_to_delete_list()
1559 struct cache_file_node *cfn = NULL; in load_cfn() local
1563 cfn = create_cfn(sbi, path, cid, server); in load_cfn()
1564 if (!cfn) in load_cfn()
1567 cfn->filp = filp_open(fullname, O_RDWR | O_LARGEFILE, 0); in load_cfn()
1568 if (IS_ERR(cfn->filp)) { in load_cfn()
1569 hmdfs_err("open fail %ld", PTR_ERR(cfn->filp)); in load_cfn()
1573 if (cache_get_dentry_count(sbi, cfn->filp) < sbi->dcache_threshold) { in load_cfn()
1574 add_to_delete_list(sbi, cfn); in load_cfn()
1578 if (!cache_check_case_sensitive(sbi, cfn->filp)) { in load_cfn()
1579 add_to_delete_list(sbi, cfn); in load_cfn()
1588 list_add_tail(&cfn->list, head); in load_cfn()
1592 add_to_delete_list(sbi, cfn); in load_cfn()
1599 free_cfn(cfn); in load_cfn()
1773 struct cache_file_node *cfn = NULL; in hmdfs_delete_useless_cfn() local
1778 list_for_each_entry_safe(cfn, n, &sbi->to_delete, list) { in hmdfs_delete_useless_cfn()
1779 delete_dentry_file(cfn->filp); in hmdfs_delete_useless_cfn()
1780 list_del_init(&cfn->list); in hmdfs_delete_useless_cfn()
1781 release_cfn(cfn); in hmdfs_delete_useless_cfn()
1812 struct cache_file_node *cfn = NULL; in __cache_file_destroy_by_path() local
1815 list_for_each_entry_safe(cfn, n, head, list) { in __cache_file_destroy_by_path()
1816 if (strcmp(path, cfn->relative_path) != 0) in __cache_file_destroy_by_path()
1818 list_del_init(&cfn->list); in __cache_file_destroy_by_path()
1819 delete_dentry_file(cfn->filp); in __cache_file_destroy_by_path()
1820 release_cfn(cfn); in __cache_file_destroy_by_path()
1838 struct cache_file_node *cfn; in cache_file_find_and_delete() local
1840 cfn = find_cfn(con->sbi, con->cid, relative_path, false); in cache_file_find_and_delete()
1841 if (!cfn) in cache_file_find_and_delete()
1844 remove_cfn(cfn); in cache_file_find_and_delete()
1845 release_cfn(cfn); in cache_file_find_and_delete()
1887 struct cache_file_node *cfn) in add_cfn_to_item() argument
1889 struct file *file = cfn->filp; in add_cfn_to_item()
1928 struct cache_file_node *cfn, in remote_file_revalidate_cfn() argument
1934 file = read_header_and_revalidate(con, cfn->filp, relative_path); in remote_file_revalidate_cfn()
1946 add_cfn_to_item(dentry, con, cfn); in remote_file_revalidate_cfn()
1951 remove_cfn(cfn); in remote_file_revalidate_cfn()
1997 struct cache_file_node *cfn = NULL; in get_remote_dentry_file() local
2025 cfn = find_cfn(sbi, con->cid, relative_path, false); in get_remote_dentry_file()
2026 if (cfn) { in get_remote_dentry_file()
2027 remote_file_revalidate_cfn(dentry, con, cfn, relative_path); in get_remote_dentry_file()
2028 release_cfn(cfn); in get_remote_dentry_file()