Lines Matching refs:ea_inode

122 void ext4_xattr_inode_set_class(struct inode *ea_inode)  in ext4_xattr_inode_set_class()  argument
124 struct ext4_inode_info *ei = EXT4_I(ea_inode); in ext4_xattr_inode_set_class()
126 lockdep_set_subclass(&ea_inode->i_rwsem, 1); in ext4_xattr_inode_set_class()
319 static u64 ext4_xattr_inode_get_ref(struct inode *ea_inode) in ext4_xattr_inode_get_ref() argument
321 return ((u64)ea_inode->i_ctime.tv_sec << 32) | in ext4_xattr_inode_get_ref()
322 (u32) inode_peek_iversion_raw(ea_inode); in ext4_xattr_inode_get_ref()
325 static void ext4_xattr_inode_set_ref(struct inode *ea_inode, u64 ref_count) in ext4_xattr_inode_set_ref() argument
327 ea_inode->i_ctime.tv_sec = (u32)(ref_count >> 32); in ext4_xattr_inode_set_ref()
328 inode_set_iversion_raw(ea_inode, ref_count & 0xffffffff); in ext4_xattr_inode_set_ref()
331 static u32 ext4_xattr_inode_get_hash(struct inode *ea_inode) in ext4_xattr_inode_get_hash() argument
333 return (u32)ea_inode->i_atime.tv_sec; in ext4_xattr_inode_get_hash()
336 static void ext4_xattr_inode_set_hash(struct inode *ea_inode, u32 hash) in ext4_xattr_inode_set_hash() argument
338 ea_inode->i_atime.tv_sec = hash; in ext4_xattr_inode_set_hash()
344 static int ext4_xattr_inode_read(struct inode *ea_inode, void *buf, size_t size) in ext4_xattr_inode_read() argument
346 int blocksize = 1 << ea_inode->i_blkbits; in ext4_xattr_inode_read()
347 int bh_count = (size + blocksize - 1) >> ea_inode->i_blkbits; in ext4_xattr_inode_read()
359 ret = ext4_bread_batch(ea_inode, 0 /* block */, bh_count, in ext4_xattr_inode_read()
386 u32 ea_inode_hash, struct inode **ea_inode) in ext4_xattr_inode_iget() argument
445 *ea_inode = inode; in ext4_xattr_inode_iget()
468 ext4_xattr_inode_verify_hashes(struct inode *ea_inode, in ext4_xattr_inode_verify_hashes() argument
475 hash = ext4_xattr_inode_hash(EXT4_SB(ea_inode->i_sb), buffer, size); in ext4_xattr_inode_verify_hashes()
476 if (hash != ext4_xattr_inode_get_hash(ea_inode)) in ext4_xattr_inode_verify_hashes()
500 struct inode *ea_inode; in ext4_xattr_inode_get() local
504 le32_to_cpu(entry->e_hash), &ea_inode); in ext4_xattr_inode_get()
506 ea_inode = NULL; in ext4_xattr_inode_get()
510 if (i_size_read(ea_inode) != size) { in ext4_xattr_inode_get()
511 ext4_warning_inode(ea_inode, in ext4_xattr_inode_get()
513 i_size_read(ea_inode), size); in ext4_xattr_inode_get()
518 err = ext4_xattr_inode_read(ea_inode, buffer, size); in ext4_xattr_inode_get()
522 if (!ext4_test_inode_state(ea_inode, EXT4_STATE_LUSTRE_EA_INODE)) { in ext4_xattr_inode_get()
523 err = ext4_xattr_inode_verify_hashes(ea_inode, entry, buffer, in ext4_xattr_inode_get()
526 ext4_warning_inode(ea_inode, in ext4_xattr_inode_get()
533 ext4_xattr_inode_get_hash(ea_inode), in ext4_xattr_inode_get()
534 ea_inode->i_ino, true /* reusable */); in ext4_xattr_inode_get()
537 iput(ea_inode); in ext4_xattr_inode_get()
907 struct inode *ea_inode, in ext4_xattr_inode_free_quota() argument
910 if (ea_inode && in ext4_xattr_inode_free_quota()
911 ext4_test_inode_state(ea_inode, EXT4_STATE_LUSTRE_EA_INODE)) in ext4_xattr_inode_free_quota()
1049 static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode, in ext4_xattr_inode_update_ref() argument
1056 inode_lock(ea_inode); in ext4_xattr_inode_update_ref()
1058 ret = ext4_reserve_inode_write(handle, ea_inode, &iloc); in ext4_xattr_inode_update_ref()
1064 ref_count = ext4_xattr_inode_get_ref(ea_inode); in ext4_xattr_inode_update_ref()
1066 ext4_xattr_inode_set_ref(ea_inode, ref_count); in ext4_xattr_inode_update_ref()
1070 ea_inode->i_ino, ref_count); in ext4_xattr_inode_update_ref()
1073 WARN_ONCE(ea_inode->i_nlink, "EA inode %lu i_nlink=%u", in ext4_xattr_inode_update_ref()
1074 ea_inode->i_ino, ea_inode->i_nlink); in ext4_xattr_inode_update_ref()
1076 set_nlink(ea_inode, 1); in ext4_xattr_inode_update_ref()
1077 ext4_orphan_del(handle, ea_inode); in ext4_xattr_inode_update_ref()
1081 ea_inode->i_ino, ref_count); in ext4_xattr_inode_update_ref()
1084 WARN_ONCE(ea_inode->i_nlink != 1, in ext4_xattr_inode_update_ref()
1086 ea_inode->i_ino, ea_inode->i_nlink); in ext4_xattr_inode_update_ref()
1088 clear_nlink(ea_inode); in ext4_xattr_inode_update_ref()
1089 ext4_orphan_add(handle, ea_inode); in ext4_xattr_inode_update_ref()
1093 ret = ext4_mark_iloc_dirty(handle, ea_inode, &iloc); in ext4_xattr_inode_update_ref()
1096 ext4_warning_inode(ea_inode, in ext4_xattr_inode_update_ref()
1100 inode_unlock(ea_inode); in ext4_xattr_inode_update_ref()
1104 static int ext4_xattr_inode_inc_ref(handle_t *handle, struct inode *ea_inode) in ext4_xattr_inode_inc_ref() argument
1106 return ext4_xattr_inode_update_ref(handle, ea_inode, 1); in ext4_xattr_inode_inc_ref()
1109 static int ext4_xattr_inode_dec_ref(handle_t *handle, struct inode *ea_inode) in ext4_xattr_inode_dec_ref() argument
1111 return ext4_xattr_inode_update_ref(handle, ea_inode, -1); in ext4_xattr_inode_dec_ref()
1117 struct inode *ea_inode; in ext4_xattr_inode_inc_ref_all() local
1130 &ea_inode); in ext4_xattr_inode_inc_ref_all()
1133 err = ext4_xattr_inode_inc_ref(handle, ea_inode); in ext4_xattr_inode_inc_ref_all()
1135 ext4_warning_inode(ea_inode, "inc ref error %d", err); in ext4_xattr_inode_inc_ref_all()
1136 iput(ea_inode); in ext4_xattr_inode_inc_ref_all()
1139 iput(ea_inode); in ext4_xattr_inode_inc_ref_all()
1154 &ea_inode); in ext4_xattr_inode_inc_ref_all()
1161 err = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_inode_inc_ref_all()
1163 ext4_warning_inode(ea_inode, "cleanup dec ref error %d", in ext4_xattr_inode_inc_ref_all()
1165 iput(ea_inode); in ext4_xattr_inode_inc_ref_all()
1177 struct inode *ea_inode; in ext4_xattr_inode_dec_ref_all() local
1194 &ea_inode); in ext4_xattr_inode_dec_ref_all()
1198 err = ext4_expand_inode_array(ea_inode_array, ea_inode); in ext4_xattr_inode_dec_ref_all()
1200 ext4_warning_inode(ea_inode, in ext4_xattr_inode_dec_ref_all()
1202 iput(ea_inode); in ext4_xattr_inode_dec_ref_all()
1209 ext4_warning_inode(ea_inode, "Ensure credits err=%d", in ext4_xattr_inode_dec_ref_all()
1214 err = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_inode_dec_ref_all()
1216 ext4_warning_inode(ea_inode, "ea_inode dec ref err=%d", in ext4_xattr_inode_dec_ref_all()
1222 ext4_xattr_inode_free_quota(parent, ea_inode, in ext4_xattr_inode_dec_ref_all()
1370 static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode, in ext4_xattr_inode_write() argument
1375 int blocksize = ea_inode->i_sb->s_blocksize; in ext4_xattr_inode_write()
1376 int max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits; in ext4_xattr_inode_write()
1387 ret = ext4_map_blocks(handle, ea_inode, &map, in ext4_xattr_inode_write()
1390 ext4_mark_inode_dirty(handle, ea_inode); in ext4_xattr_inode_write()
1392 ext4_should_retry_alloc(ea_inode->i_sb, &retries)) { in ext4_xattr_inode_write()
1409 bh = ext4_getblk(handle, ea_inode, block, 0); in ext4_xattr_inode_write()
1414 EXT4_ERROR_INODE(ea_inode, in ext4_xattr_inode_write()
1424 ext4_handle_dirty_metadata(handle, ea_inode, bh); in ext4_xattr_inode_write()
1431 inode_lock(ea_inode); in ext4_xattr_inode_write()
1432 i_size_write(ea_inode, wsize); in ext4_xattr_inode_write()
1433 ext4_update_i_disksize(ea_inode, wsize); in ext4_xattr_inode_write()
1434 inode_unlock(ea_inode); in ext4_xattr_inode_write()
1436 ext4_mark_inode_dirty(handle, ea_inode); in ext4_xattr_inode_write()
1450 struct inode *ea_inode = NULL; in ext4_xattr_inode_create() local
1465 ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, in ext4_xattr_inode_create()
1468 if (!IS_ERR(ea_inode)) { in ext4_xattr_inode_create()
1469 ea_inode->i_op = &ext4_file_inode_operations; in ext4_xattr_inode_create()
1470 ea_inode->i_fop = &ext4_file_operations; in ext4_xattr_inode_create()
1471 ext4_set_aops(ea_inode); in ext4_xattr_inode_create()
1472 ext4_xattr_inode_set_class(ea_inode); in ext4_xattr_inode_create()
1473 unlock_new_inode(ea_inode); in ext4_xattr_inode_create()
1474 ext4_xattr_inode_set_ref(ea_inode, 1); in ext4_xattr_inode_create()
1475 ext4_xattr_inode_set_hash(ea_inode, hash); in ext4_xattr_inode_create()
1476 err = ext4_mark_inode_dirty(handle, ea_inode); in ext4_xattr_inode_create()
1478 err = ext4_inode_attach_jinode(ea_inode); in ext4_xattr_inode_create()
1480 if (ext4_xattr_inode_dec_ref(handle, ea_inode)) in ext4_xattr_inode_create()
1481 ext4_warning_inode(ea_inode, in ext4_xattr_inode_create()
1483 iput(ea_inode); in ext4_xattr_inode_create()
1491 dquot_free_inode(ea_inode); in ext4_xattr_inode_create()
1492 dquot_drop(ea_inode); in ext4_xattr_inode_create()
1493 inode_lock(ea_inode); in ext4_xattr_inode_create()
1494 ea_inode->i_flags |= S_NOQUOTA; in ext4_xattr_inode_create()
1495 inode_unlock(ea_inode); in ext4_xattr_inode_create()
1498 return ea_inode; in ext4_xattr_inode_create()
1505 struct inode *ea_inode; in ext4_xattr_inode_cache_find() local
1527 ea_inode = ext4_iget(inode->i_sb, ce->e_value, in ext4_xattr_inode_cache_find()
1529 if (!IS_ERR(ea_inode) && in ext4_xattr_inode_cache_find()
1530 !is_bad_inode(ea_inode) && in ext4_xattr_inode_cache_find()
1531 (EXT4_I(ea_inode)->i_flags & EXT4_EA_INODE_FL) && in ext4_xattr_inode_cache_find()
1532 i_size_read(ea_inode) == value_len && in ext4_xattr_inode_cache_find()
1533 !ext4_xattr_inode_read(ea_inode, ea_data, value_len) && in ext4_xattr_inode_cache_find()
1534 !ext4_xattr_inode_verify_hashes(ea_inode, NULL, ea_data, in ext4_xattr_inode_cache_find()
1540 return ea_inode; in ext4_xattr_inode_cache_find()
1543 if (!IS_ERR(ea_inode)) in ext4_xattr_inode_cache_find()
1544 iput(ea_inode); in ext4_xattr_inode_cache_find()
1558 struct inode *ea_inode; in ext4_xattr_inode_lookup_create() local
1563 ea_inode = ext4_xattr_inode_cache_find(inode, value, value_len, hash); in ext4_xattr_inode_lookup_create()
1564 if (ea_inode) { in ext4_xattr_inode_lookup_create()
1565 err = ext4_xattr_inode_inc_ref(handle, ea_inode); in ext4_xattr_inode_lookup_create()
1567 iput(ea_inode); in ext4_xattr_inode_lookup_create()
1571 *ret_inode = ea_inode; in ext4_xattr_inode_lookup_create()
1576 ea_inode = ext4_xattr_inode_create(handle, inode, hash); in ext4_xattr_inode_lookup_create()
1577 if (IS_ERR(ea_inode)) in ext4_xattr_inode_lookup_create()
1578 return PTR_ERR(ea_inode); in ext4_xattr_inode_lookup_create()
1580 err = ext4_xattr_inode_write(handle, ea_inode, value, value_len); in ext4_xattr_inode_lookup_create()
1582 ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_inode_lookup_create()
1583 iput(ea_inode); in ext4_xattr_inode_lookup_create()
1589 ea_inode->i_ino, true /* reusable */); in ext4_xattr_inode_lookup_create()
1591 *ret_inode = ea_inode; in ext4_xattr_inode_lookup_create()
1915 struct inode *ea_inode = NULL, *tmp_inode; in ext4_xattr_block_set() local
2040 &ea_inode); in ext4_xattr_block_set()
2042 ea_inode = NULL; in ext4_xattr_block_set()
2147 if (ea_inode) { in ext4_xattr_block_set()
2150 ea_inode); in ext4_xattr_block_set()
2152 ext4_warning_inode(ea_inode, in ext4_xattr_block_set()
2155 iput(ea_inode); in ext4_xattr_block_set()
2156 ea_inode = NULL; in ext4_xattr_block_set()
2196 if (ea_inode) { in ext4_xattr_block_set()
2199 error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_block_set()
2201 ext4_warning_inode(ea_inode, "dec ref error=%d", in ext4_xattr_block_set()
2206 ext4_xattr_inode_free_quota(inode, ea_inode, in ext4_xattr_block_set()
2207 i_size_read(ea_inode)); in ext4_xattr_block_set()
2208 iput(ea_inode); in ext4_xattr_block_set()
2907 struct inode *ea_inode; in ext4_xattr_delete_inode() local
2967 &ea_inode); in ext4_xattr_delete_inode()
2970 ext4_xattr_inode_free_quota(inode, ea_inode, in ext4_xattr_delete_inode()
2972 iput(ea_inode); in ext4_xattr_delete_inode()