inode.c (fb01bfdac733f1925561eea52c60072f2fbcdc97) | inode.c (1d1fe1ee02b9ac2660995b10e35dd41448fef011) |
---|---|
1/* 2 * linux/fs/ext4/inode.c 3 * 4 * Copyright (C) 1992, 1993, 1994, 1995 5 * Remy Card (card@masi.ibp.fr) 6 * Laboratoire MASI - Institut Blaise Pascal 7 * Universite Pierre et Marie Curie (Paris VI) 8 * --- 2666 unchanged lines hidden (view full) --- 2675 } else { 2676 return i_blocks; 2677 } 2678 } else { 2679 return le32_to_cpu(raw_inode->i_blocks_lo); 2680 } 2681} 2682 | 1/* 2 * linux/fs/ext4/inode.c 3 * 4 * Copyright (C) 1992, 1993, 1994, 1995 5 * Remy Card (card@masi.ibp.fr) 6 * Laboratoire MASI - Institut Blaise Pascal 7 * Universite Pierre et Marie Curie (Paris VI) 8 * --- 2666 unchanged lines hidden (view full) --- 2675 } else { 2676 return i_blocks; 2677 } 2678 } else { 2679 return le32_to_cpu(raw_inode->i_blocks_lo); 2680 } 2681} 2682 |
2683void ext4_read_inode(struct inode * inode) | 2683struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
2684{ 2685 struct ext4_iloc iloc; 2686 struct ext4_inode *raw_inode; | 2684{ 2685 struct ext4_iloc iloc; 2686 struct ext4_inode *raw_inode; |
2687 struct ext4_inode_info *ei = EXT4_I(inode); | 2687 struct ext4_inode_info *ei; |
2688 struct buffer_head *bh; | 2688 struct buffer_head *bh; |
2689 struct inode *inode; 2690 long ret; |
|
2689 int block; 2690 | 2691 int block; 2692 |
2693 inode = iget_locked(sb, ino); 2694 if (!inode) 2695 return ERR_PTR(-ENOMEM); 2696 if (!(inode->i_state & I_NEW)) 2697 return inode; 2698 2699 ei = EXT4_I(inode); |
|
2691#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL 2692 ei->i_acl = EXT4_ACL_NOT_CACHED; 2693 ei->i_default_acl = EXT4_ACL_NOT_CACHED; 2694#endif 2695 ei->i_block_alloc_info = NULL; 2696 | 2700#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL 2701 ei->i_acl = EXT4_ACL_NOT_CACHED; 2702 ei->i_default_acl = EXT4_ACL_NOT_CACHED; 2703#endif 2704 ei->i_block_alloc_info = NULL; 2705 |
2697 if (__ext4_get_inode_loc(inode, &iloc, 0)) | 2706 ret = __ext4_get_inode_loc(inode, &iloc, 0); 2707 if (ret < 0) |
2698 goto bad_inode; 2699 bh = iloc.bh; 2700 raw_inode = ext4_raw_inode(&iloc); 2701 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 2702 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 2703 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 2704 if(!(test_opt (inode->i_sb, NO_UID32))) { 2705 inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16; --- 9 unchanged lines hidden (view full) --- 2715 * the test is that same one that e2fsck uses 2716 * NeilBrown 1999oct15 2717 */ 2718 if (inode->i_nlink == 0) { 2719 if (inode->i_mode == 0 || 2720 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) { 2721 /* this inode is deleted */ 2722 brelse (bh); | 2708 goto bad_inode; 2709 bh = iloc.bh; 2710 raw_inode = ext4_raw_inode(&iloc); 2711 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 2712 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 2713 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 2714 if(!(test_opt (inode->i_sb, NO_UID32))) { 2715 inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16; --- 9 unchanged lines hidden (view full) --- 2725 * the test is that same one that e2fsck uses 2726 * NeilBrown 1999oct15 2727 */ 2728 if (inode->i_nlink == 0) { 2729 if (inode->i_mode == 0 || 2730 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) { 2731 /* this inode is deleted */ 2732 brelse (bh); |
2733 ret = -ESTALE; |
|
2723 goto bad_inode; 2724 } 2725 /* The only unlinked inodes we let through here have 2726 * valid i_mode and are being read by the orphan 2727 * recovery code: that's fine, we're about to complete 2728 * the process of deleting those. */ 2729 } 2730 ei->i_flags = le32_to_cpu(raw_inode->i_flags); --- 22 unchanged lines hidden (view full) --- 2753 * When mke2fs creates big inodes it does not zero out 2754 * the unused bytes above EXT4_GOOD_OLD_INODE_SIZE, 2755 * so ignore those first few inodes. 2756 */ 2757 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); 2758 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > 2759 EXT4_INODE_SIZE(inode->i_sb)) { 2760 brelse (bh); | 2734 goto bad_inode; 2735 } 2736 /* The only unlinked inodes we let through here have 2737 * valid i_mode and are being read by the orphan 2738 * recovery code: that's fine, we're about to complete 2739 * the process of deleting those. */ 2740 } 2741 ei->i_flags = le32_to_cpu(raw_inode->i_flags); --- 22 unchanged lines hidden (view full) --- 2764 * When mke2fs creates big inodes it does not zero out 2765 * the unused bytes above EXT4_GOOD_OLD_INODE_SIZE, 2766 * so ignore those first few inodes. 2767 */ 2768 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); 2769 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > 2770 EXT4_INODE_SIZE(inode->i_sb)) { 2771 brelse (bh); |
2772 ret = -EIO; |
|
2761 goto bad_inode; 2762 } 2763 if (ei->i_extra_isize == 0) { 2764 /* The extra space is currently unused. Use it. */ 2765 ei->i_extra_isize = sizeof(struct ext4_inode) - 2766 EXT4_GOOD_OLD_INODE_SIZE; 2767 } else { 2768 __le32 *magic = (void *)raw_inode + --- 37 unchanged lines hidden (view full) --- 2806 init_special_inode(inode, inode->i_mode, 2807 old_decode_dev(le32_to_cpu(raw_inode->i_block[0]))); 2808 else 2809 init_special_inode(inode, inode->i_mode, 2810 new_decode_dev(le32_to_cpu(raw_inode->i_block[1]))); 2811 } 2812 brelse (iloc.bh); 2813 ext4_set_inode_flags(inode); | 2773 goto bad_inode; 2774 } 2775 if (ei->i_extra_isize == 0) { 2776 /* The extra space is currently unused. Use it. */ 2777 ei->i_extra_isize = sizeof(struct ext4_inode) - 2778 EXT4_GOOD_OLD_INODE_SIZE; 2779 } else { 2780 __le32 *magic = (void *)raw_inode + --- 37 unchanged lines hidden (view full) --- 2818 init_special_inode(inode, inode->i_mode, 2819 old_decode_dev(le32_to_cpu(raw_inode->i_block[0]))); 2820 else 2821 init_special_inode(inode, inode->i_mode, 2822 new_decode_dev(le32_to_cpu(raw_inode->i_block[1]))); 2823 } 2824 brelse (iloc.bh); 2825 ext4_set_inode_flags(inode); |
2814 return; | 2826 unlock_new_inode(inode); 2827 return inode; |
2815 2816bad_inode: | 2828 2829bad_inode: |
2817 make_bad_inode(inode); 2818 return; | 2830 iget_failed(inode); 2831 return ERR_PTR(ret); |
2819} 2820 2821static int ext4_inode_blocks_set(handle_t *handle, 2822 struct ext4_inode *raw_inode, 2823 struct ext4_inode_info *ei) 2824{ 2825 struct inode *inode = &(ei->vfs_inode); 2826 u64 i_blocks = inode->i_blocks; --- 631 unchanged lines hidden --- | 2832} 2833 2834static int ext4_inode_blocks_set(handle_t *handle, 2835 struct ext4_inode *raw_inode, 2836 struct ext4_inode_info *ei) 2837{ 2838 struct inode *inode = &(ei->vfs_inode); 2839 u64 i_blocks = inode->i_blocks; --- 631 unchanged lines hidden --- |