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()
357 static u64 ext4_xattr_inode_get_ref(struct inode *ea_inode) in ext4_xattr_inode_get_ref() argument
359 return ((u64) inode_get_ctime_sec(ea_inode) << 32) | in ext4_xattr_inode_get_ref()
360 (u32) inode_peek_iversion_raw(ea_inode); in ext4_xattr_inode_get_ref()
363 static void ext4_xattr_inode_set_ref(struct inode *ea_inode, u64 ref_count) in ext4_xattr_inode_set_ref() argument
365 inode_set_ctime(ea_inode, (u32)(ref_count >> 32), 0); in ext4_xattr_inode_set_ref()
366 inode_set_iversion_raw(ea_inode, ref_count & 0xffffffff); in ext4_xattr_inode_set_ref()
369 static u32 ext4_xattr_inode_get_hash(struct inode *ea_inode) in ext4_xattr_inode_get_hash() argument
371 return (u32) inode_get_atime_sec(ea_inode); in ext4_xattr_inode_get_hash()
374 static void ext4_xattr_inode_set_hash(struct inode *ea_inode, u32 hash) in ext4_xattr_inode_set_hash() argument
376 inode_set_atime(ea_inode, hash, 0); in ext4_xattr_inode_set_hash()
382 static int ext4_xattr_inode_read(struct inode *ea_inode, void *buf, size_t size) in ext4_xattr_inode_read() argument
384 int blocksize = 1 << ea_inode->i_blkbits; in ext4_xattr_inode_read()
385 int bh_count = (size + blocksize - 1) >> ea_inode->i_blkbits; in ext4_xattr_inode_read()
397 ret = ext4_bread_batch(ea_inode, 0 /* block */, bh_count, in ext4_xattr_inode_read()
424 u32 ea_inode_hash, struct inode **ea_inode) in ext4_xattr_inode_iget() argument
466 *ea_inode = inode; in ext4_xattr_inode_iget()
486 ext4_xattr_inode_verify_hashes(struct inode *ea_inode, in ext4_xattr_inode_verify_hashes() argument
493 hash = ext4_xattr_inode_hash(EXT4_SB(ea_inode->i_sb), buffer, size); in ext4_xattr_inode_verify_hashes()
494 if (hash != ext4_xattr_inode_get_hash(ea_inode)) in ext4_xattr_inode_verify_hashes()
532 struct inode *ea_inode; in ext4_xattr_inode_get() local
536 le32_to_cpu(entry->e_hash), &ea_inode); in ext4_xattr_inode_get()
538 ea_inode = NULL; in ext4_xattr_inode_get()
542 if (i_size_read(ea_inode) != size) { in ext4_xattr_inode_get()
543 ext4_warning_inode(ea_inode, in ext4_xattr_inode_get()
545 i_size_read(ea_inode), size); in ext4_xattr_inode_get()
550 err = ext4_xattr_inode_read(ea_inode, buffer, size); in ext4_xattr_inode_get()
554 if (!ext4_test_inode_state(ea_inode, EXT4_STATE_LUSTRE_EA_INODE)) { in ext4_xattr_inode_get()
555 err = ext4_xattr_inode_verify_hashes(ea_inode, entry, buffer, in ext4_xattr_inode_get()
558 ext4_warning_inode(ea_inode, in ext4_xattr_inode_get()
565 ext4_xattr_inode_get_hash(ea_inode), in ext4_xattr_inode_get()
566 ea_inode->i_ino, true /* reusable */); in ext4_xattr_inode_get()
569 iput(ea_inode); in ext4_xattr_inode_get()
942 struct inode *ea_inode, in ext4_xattr_inode_free_quota() argument
945 if (ea_inode && in ext4_xattr_inode_free_quota()
946 ext4_test_inode_state(ea_inode, EXT4_STATE_LUSTRE_EA_INODE)) in ext4_xattr_inode_free_quota()
1035 static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode, in ext4_xattr_inode_update_ref() argument
1042 inode_lock_nested(ea_inode, I_MUTEX_XATTR); in ext4_xattr_inode_update_ref()
1044 ret = ext4_reserve_inode_write(handle, ea_inode, &iloc); in ext4_xattr_inode_update_ref()
1048 ref_count = ext4_xattr_inode_get_ref(ea_inode); in ext4_xattr_inode_update_ref()
1050 ext4_xattr_inode_set_ref(ea_inode, ref_count); in ext4_xattr_inode_update_ref()
1054 ea_inode->i_ino, ref_count); in ext4_xattr_inode_update_ref()
1057 WARN_ONCE(ea_inode->i_nlink, "EA inode %lu i_nlink=%u", in ext4_xattr_inode_update_ref()
1058 ea_inode->i_ino, ea_inode->i_nlink); in ext4_xattr_inode_update_ref()
1060 set_nlink(ea_inode, 1); in ext4_xattr_inode_update_ref()
1061 ext4_orphan_del(handle, ea_inode); in ext4_xattr_inode_update_ref()
1065 ea_inode->i_ino, ref_count); in ext4_xattr_inode_update_ref()
1068 WARN_ONCE(ea_inode->i_nlink != 1, in ext4_xattr_inode_update_ref()
1070 ea_inode->i_ino, ea_inode->i_nlink); in ext4_xattr_inode_update_ref()
1072 clear_nlink(ea_inode); in ext4_xattr_inode_update_ref()
1073 ext4_orphan_add(handle, ea_inode); in ext4_xattr_inode_update_ref()
1077 ret = ext4_mark_iloc_dirty(handle, ea_inode, &iloc); in ext4_xattr_inode_update_ref()
1079 ext4_warning_inode(ea_inode, in ext4_xattr_inode_update_ref()
1082 inode_unlock(ea_inode); in ext4_xattr_inode_update_ref()
1086 static int ext4_xattr_inode_inc_ref(handle_t *handle, struct inode *ea_inode) in ext4_xattr_inode_inc_ref() argument
1088 return ext4_xattr_inode_update_ref(handle, ea_inode, 1); in ext4_xattr_inode_inc_ref()
1091 static int ext4_xattr_inode_dec_ref(handle_t *handle, struct inode *ea_inode) in ext4_xattr_inode_dec_ref() argument
1093 return ext4_xattr_inode_update_ref(handle, ea_inode, -1); in ext4_xattr_inode_dec_ref()
1099 struct inode *ea_inode; in ext4_xattr_inode_inc_ref_all() local
1112 &ea_inode); in ext4_xattr_inode_inc_ref_all()
1115 err = ext4_xattr_inode_inc_ref(handle, ea_inode); in ext4_xattr_inode_inc_ref_all()
1117 ext4_warning_inode(ea_inode, "inc ref error %d", err); in ext4_xattr_inode_inc_ref_all()
1118 iput(ea_inode); in ext4_xattr_inode_inc_ref_all()
1121 iput(ea_inode); in ext4_xattr_inode_inc_ref_all()
1136 &ea_inode); in ext4_xattr_inode_inc_ref_all()
1143 err = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_inode_inc_ref_all()
1145 ext4_warning_inode(ea_inode, "cleanup dec ref error %d", in ext4_xattr_inode_inc_ref_all()
1147 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()
1211 ext4_warning_inode(ea_inode, "Ensure credits err=%d", in ext4_xattr_inode_dec_ref_all()
1219 ext4_warning_inode(ea_inode, in ext4_xattr_inode_dec_ref_all()
1226 err = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_inode_dec_ref_all()
1228 ext4_warning_inode(ea_inode, "ea_inode dec ref err=%d", in ext4_xattr_inode_dec_ref_all()
1234 ext4_xattr_inode_free_quota(parent, ea_inode, in ext4_xattr_inode_dec_ref_all()
1383 static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode, in ext4_xattr_inode_write() argument
1388 int blocksize = ea_inode->i_sb->s_blocksize; in ext4_xattr_inode_write()
1389 int max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits; in ext4_xattr_inode_write()
1400 ret = ext4_map_blocks(handle, ea_inode, &map, in ext4_xattr_inode_write()
1403 ext4_mark_inode_dirty(handle, ea_inode); in ext4_xattr_inode_write()
1405 ext4_should_retry_alloc(ea_inode->i_sb, &retries)) { in ext4_xattr_inode_write()
1421 bh = ext4_getblk(handle, ea_inode, block, 0); in ext4_xattr_inode_write()
1426 EXT4_ERROR_INODE(ea_inode, in ext4_xattr_inode_write()
1430 ret = ext4_journal_get_write_access(handle, ea_inode->i_sb, bh, in ext4_xattr_inode_write()
1443 ext4_handle_dirty_metadata(handle, ea_inode, bh); in ext4_xattr_inode_write()
1450 inode_lock(ea_inode); in ext4_xattr_inode_write()
1451 i_size_write(ea_inode, wsize); in ext4_xattr_inode_write()
1452 ext4_update_i_disksize(ea_inode, wsize); in ext4_xattr_inode_write()
1453 inode_unlock(ea_inode); in ext4_xattr_inode_write()
1455 ret2 = ext4_mark_inode_dirty(handle, ea_inode); in ext4_xattr_inode_write()
1471 struct inode *ea_inode = NULL; in ext4_xattr_inode_create() local
1486 ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, in ext4_xattr_inode_create()
1489 if (!IS_ERR(ea_inode)) { in ext4_xattr_inode_create()
1490 ea_inode->i_op = &ext4_file_inode_operations; in ext4_xattr_inode_create()
1491 ea_inode->i_fop = &ext4_file_operations; in ext4_xattr_inode_create()
1492 ext4_set_aops(ea_inode); in ext4_xattr_inode_create()
1493 ext4_xattr_inode_set_class(ea_inode); in ext4_xattr_inode_create()
1494 unlock_new_inode(ea_inode); in ext4_xattr_inode_create()
1495 ext4_xattr_inode_set_ref(ea_inode, 1); in ext4_xattr_inode_create()
1496 ext4_xattr_inode_set_hash(ea_inode, hash); in ext4_xattr_inode_create()
1497 err = ext4_mark_inode_dirty(handle, ea_inode); in ext4_xattr_inode_create()
1499 err = ext4_inode_attach_jinode(ea_inode); in ext4_xattr_inode_create()
1501 if (ext4_xattr_inode_dec_ref(handle, ea_inode)) in ext4_xattr_inode_create()
1502 ext4_warning_inode(ea_inode, in ext4_xattr_inode_create()
1504 iput(ea_inode); in ext4_xattr_inode_create()
1512 dquot_free_inode(ea_inode); in ext4_xattr_inode_create()
1513 dquot_drop(ea_inode); in ext4_xattr_inode_create()
1514 inode_lock(ea_inode); in ext4_xattr_inode_create()
1515 ea_inode->i_flags |= S_NOQUOTA; in ext4_xattr_inode_create()
1516 inode_unlock(ea_inode); in ext4_xattr_inode_create()
1519 return ea_inode; in ext4_xattr_inode_create()
1526 struct inode *ea_inode; in ext4_xattr_inode_cache_find() local
1548 ea_inode = ext4_iget(inode->i_sb, ce->e_value, in ext4_xattr_inode_cache_find()
1550 if (IS_ERR(ea_inode)) in ext4_xattr_inode_cache_find()
1552 ext4_xattr_inode_set_class(ea_inode); in ext4_xattr_inode_cache_find()
1553 if (i_size_read(ea_inode) == value_len && in ext4_xattr_inode_cache_find()
1554 !ext4_xattr_inode_read(ea_inode, ea_data, value_len) && in ext4_xattr_inode_cache_find()
1555 !ext4_xattr_inode_verify_hashes(ea_inode, NULL, ea_data, in ext4_xattr_inode_cache_find()
1561 return ea_inode; in ext4_xattr_inode_cache_find()
1563 iput(ea_inode); in ext4_xattr_inode_cache_find()
1577 struct inode *ea_inode; in ext4_xattr_inode_lookup_create() local
1587 ea_inode = ext4_xattr_inode_cache_find(inode, value, value_len, hash); in ext4_xattr_inode_lookup_create()
1588 if (ea_inode) { in ext4_xattr_inode_lookup_create()
1589 err = ext4_xattr_inode_inc_ref(handle, ea_inode); in ext4_xattr_inode_lookup_create()
1592 return ea_inode; in ext4_xattr_inode_lookup_create()
1596 ea_inode = ext4_xattr_inode_create(handle, inode, hash); in ext4_xattr_inode_lookup_create()
1597 if (IS_ERR(ea_inode)) { in ext4_xattr_inode_lookup_create()
1599 return ea_inode; in ext4_xattr_inode_lookup_create()
1602 err = ext4_xattr_inode_write(handle, ea_inode, value, value_len); in ext4_xattr_inode_lookup_create()
1604 if (ext4_xattr_inode_dec_ref(handle, ea_inode)) in ext4_xattr_inode_lookup_create()
1605 ext4_warning_inode(ea_inode, "cleanup dec ref error %d", err); in ext4_xattr_inode_lookup_create()
1611 ea_inode->i_ino, true /* reusable */); in ext4_xattr_inode_lookup_create()
1612 return ea_inode; in ext4_xattr_inode_lookup_create()
1614 iput(ea_inode); in ext4_xattr_inode_lookup_create()
1906 struct inode *ea_inode = NULL, *tmp_inode; in ext4_xattr_block_set() local
1916 ea_inode = ext4_xattr_inode_lookup_create(handle, inode, in ext4_xattr_block_set()
1918 if (IS_ERR(ea_inode)) { in ext4_xattr_block_set()
1919 error = PTR_ERR(ea_inode); in ext4_xattr_block_set()
1920 ea_inode = NULL; in ext4_xattr_block_set()
1960 ea_inode, true /* is_block */); in ext4_xattr_block_set()
2028 error = ext4_xattr_set_entry(i, s, handle, inode, ea_inode, in ext4_xattr_block_set()
2141 if (ea_inode) { in ext4_xattr_block_set()
2144 ea_inode); in ext4_xattr_block_set()
2146 ext4_warning_inode(ea_inode, in ext4_xattr_block_set()
2149 iput(ea_inode); in ext4_xattr_block_set()
2150 ea_inode = NULL; in ext4_xattr_block_set()
2191 if (ea_inode) { in ext4_xattr_block_set()
2195 error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_block_set()
2197 ext4_warning_inode(ea_inode, "dec ref error=%d", in ext4_xattr_block_set()
2199 ext4_xattr_inode_free_quota(inode, ea_inode, in ext4_xattr_block_set()
2200 i_size_read(ea_inode)); in ext4_xattr_block_set()
2202 iput(ea_inode); in ext4_xattr_block_set()
2259 struct inode *ea_inode = NULL; in ext4_xattr_ibody_set() local
2269 ea_inode = ext4_xattr_inode_lookup_create(handle, inode, in ext4_xattr_ibody_set()
2271 if (IS_ERR(ea_inode)) in ext4_xattr_ibody_set()
2272 return PTR_ERR(ea_inode); in ext4_xattr_ibody_set()
2274 error = ext4_xattr_set_entry(i, s, handle, inode, ea_inode, in ext4_xattr_ibody_set()
2277 if (ea_inode) { in ext4_xattr_ibody_set()
2280 error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); in ext4_xattr_ibody_set()
2282 ext4_warning_inode(ea_inode, "dec ref error=%d", in ext4_xattr_ibody_set()
2285 ext4_xattr_inode_free_quota(inode, ea_inode, in ext4_xattr_ibody_set()
2286 i_size_read(ea_inode)); in ext4_xattr_ibody_set()
2287 iput(ea_inode); in ext4_xattr_ibody_set()
2299 iput(ea_inode); in ext4_xattr_ibody_set()
2928 struct inode *ea_inode; in ext4_xattr_delete_inode() local
2989 &ea_inode); in ext4_xattr_delete_inode()
2992 ext4_xattr_inode_free_quota(inode, ea_inode, in ext4_xattr_delete_inode()
2994 iput(ea_inode); in ext4_xattr_delete_inode()