xattr.c (dec214d00e0d78a08b947d7dccdfdb84407a9f4d) | xattr.c (7a9ca53aea10ad4677a0f347ad7639c304b80194) |
---|---|
1/* 2 * linux/fs/ext4/xattr.c 3 * 4 * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> 5 * 6 * Fix by Harrison Xing <harrison@mountainviewdata.com>. 7 * Ext4 code with a lot of help from Eric Jarman <ejarman@acm.org>. 8 * Extended attributes for symlinks and special files added per --- 719 unchanged lines hidden (view full) --- 728 729 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access"); 730 if (ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh) == 0) { 731 ext4_set_feature_xattr(sb); 732 ext4_handle_dirty_super(handle, sb); 733 } 734} 735 | 1/* 2 * linux/fs/ext4/xattr.c 3 * 4 * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> 5 * 6 * Fix by Harrison Xing <harrison@mountainviewdata.com>. 7 * Ext4 code with a lot of help from Eric Jarman <ejarman@acm.org>. 8 * Extended attributes for symlinks and special files added per --- 719 unchanged lines hidden (view full) --- 728 729 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access"); 730 if (ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh) == 0) { 731 ext4_set_feature_xattr(sb); 732 ext4_handle_dirty_super(handle, sb); 733 } 734} 735 |
736int ext4_get_inode_usage(struct inode *inode, qsize_t *usage) 737{ 738 struct ext4_iloc iloc = { .bh = NULL }; 739 struct buffer_head *bh = NULL; 740 struct ext4_inode *raw_inode; 741 struct ext4_xattr_ibody_header *header; 742 struct ext4_xattr_entry *entry; 743 qsize_t ea_inode_refs = 0; 744 void *end; 745 int ret; 746 747 lockdep_assert_held_read(&EXT4_I(inode)->xattr_sem); 748 749 if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) { 750 ret = ext4_get_inode_loc(inode, &iloc); 751 if (ret) 752 goto out; 753 raw_inode = ext4_raw_inode(&iloc); 754 header = IHDR(inode, raw_inode); 755 end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; 756 ret = xattr_check_inode(inode, header, end); 757 if (ret) 758 goto out; 759 760 for (entry = IFIRST(header); !IS_LAST_ENTRY(entry); 761 entry = EXT4_XATTR_NEXT(entry)) 762 if (entry->e_value_inum) 763 ea_inode_refs++; 764 } 765 766 if (EXT4_I(inode)->i_file_acl) { 767 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); 768 if (!bh) { 769 ret = -EIO; 770 goto out; 771 } 772 773 if (ext4_xattr_check_block(inode, bh)) { 774 ret = -EFSCORRUPTED; 775 goto out; 776 } 777 778 for (entry = BFIRST(bh); !IS_LAST_ENTRY(entry); 779 entry = EXT4_XATTR_NEXT(entry)) 780 if (entry->e_value_inum) 781 ea_inode_refs++; 782 } 783 *usage = ea_inode_refs + 1; 784 ret = 0; 785out: 786 brelse(iloc.bh); 787 brelse(bh); 788 return ret; 789} 790 |
|
736static inline size_t round_up_cluster(struct inode *inode, size_t length) 737{ 738 struct super_block *sb = inode->i_sb; 739 size_t cluster_size = 1 << (EXT4_SB(sb)->s_cluster_bits + 740 inode->i_blkbits); 741 size_t mask = ~(cluster_size - 1); 742 743 return (length + cluster_size - 1) & mask; --- 2198 unchanged lines hidden --- | 791static inline size_t round_up_cluster(struct inode *inode, size_t length) 792{ 793 struct super_block *sb = inode->i_sb; 794 size_t cluster_size = 1 << (EXT4_SB(sb)->s_cluster_bits + 795 inode->i_blkbits); 796 size_t mask = ~(cluster_size - 1); 797 798 return (length + cluster_size - 1) & mask; --- 2198 unchanged lines hidden --- |