| .. | .. |
|---|
| 52 | 52 | /* |
|---|
| 53 | 53 | * Was i_next_alloc_goal in ext2_inode_info |
|---|
| 54 | 54 | * is the *physical* companion to i_next_alloc_block. |
|---|
| 55 | | - * it the the physical block number of the block which was most-recentl |
|---|
| 56 | | - * allocated to this file. This give us the goal (target) for the next |
|---|
| 55 | + * it is the physical block number of the block which was most-recently |
|---|
| 56 | + * allocated to this file. This gives us the goal (target) for the next |
|---|
| 57 | 57 | * allocation when we detect linearly ascending requests. |
|---|
| 58 | 58 | */ |
|---|
| 59 | 59 | ext2_fsblk_t last_alloc_physical_block; |
|---|
| .. | .. |
|---|
| 68 | 68 | * second extended-fs super-block data in memory |
|---|
| 69 | 69 | */ |
|---|
| 70 | 70 | struct ext2_sb_info { |
|---|
| 71 | | - unsigned long s_frag_size; /* Size of a fragment in bytes */ |
|---|
| 72 | | - unsigned long s_frags_per_block;/* Number of fragments per block */ |
|---|
| 73 | 71 | unsigned long s_inodes_per_block;/* Number of inodes per block */ |
|---|
| 74 | | - unsigned long s_frags_per_group;/* Number of fragments in a group */ |
|---|
| 75 | 72 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ |
|---|
| 76 | 73 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ |
|---|
| 77 | 74 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ |
|---|
| .. | .. |
|---|
| 177 | 174 | #define EXT2_MIN_BLOCK_SIZE 1024 |
|---|
| 178 | 175 | #define EXT2_MAX_BLOCK_SIZE 4096 |
|---|
| 179 | 176 | #define EXT2_MIN_BLOCK_LOG_SIZE 10 |
|---|
| 177 | +#define EXT2_MAX_BLOCK_LOG_SIZE 16 |
|---|
| 180 | 178 | #define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) |
|---|
| 181 | 179 | #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) |
|---|
| 182 | 180 | #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) |
|---|
| 183 | 181 | #define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits) |
|---|
| 184 | 182 | #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) |
|---|
| 185 | 183 | #define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) |
|---|
| 186 | | - |
|---|
| 187 | | -/* |
|---|
| 188 | | - * Macro-instructions used to manage fragments |
|---|
| 189 | | - */ |
|---|
| 190 | | -#define EXT2_MIN_FRAG_SIZE 1024 |
|---|
| 191 | | -#define EXT2_MAX_FRAG_SIZE 4096 |
|---|
| 192 | | -#define EXT2_MIN_FRAG_LOG_SIZE 10 |
|---|
| 193 | | -#define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size) |
|---|
| 194 | | -#define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block) |
|---|
| 195 | 184 | |
|---|
| 196 | 185 | /* |
|---|
| 197 | 186 | * Structure of a blocks group descriptor |
|---|
| .. | .. |
|---|
| 374 | 363 | /* |
|---|
| 375 | 364 | * Mount flags |
|---|
| 376 | 365 | */ |
|---|
| 377 | | -#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */ |
|---|
| 378 | 366 | #define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */ |
|---|
| 379 | 367 | #define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */ |
|---|
| 380 | 368 | #define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */ |
|---|
| .. | .. |
|---|
| 390 | 378 | #define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */ |
|---|
| 391 | 379 | #define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */ |
|---|
| 392 | 380 | #define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */ |
|---|
| 393 | | -#ifdef CONFIG_FS_DAX |
|---|
| 394 | 381 | #define EXT2_MOUNT_DAX 0x100000 /* Direct Access */ |
|---|
| 395 | | -#else |
|---|
| 396 | | -#define EXT2_MOUNT_DAX 0 |
|---|
| 397 | | -#endif |
|---|
| 398 | 382 | |
|---|
| 399 | 383 | |
|---|
| 400 | 384 | #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt |
|---|
| .. | .. |
|---|
| 608 | 592 | }; |
|---|
| 609 | 593 | |
|---|
| 610 | 594 | /* |
|---|
| 611 | | - * Ext2 directory file types. Only the low 3 bits are used. The |
|---|
| 612 | | - * other bits are reserved for now. |
|---|
| 613 | | - */ |
|---|
| 614 | | -enum { |
|---|
| 615 | | - EXT2_FT_UNKNOWN = 0, |
|---|
| 616 | | - EXT2_FT_REG_FILE = 1, |
|---|
| 617 | | - EXT2_FT_DIR = 2, |
|---|
| 618 | | - EXT2_FT_CHRDEV = 3, |
|---|
| 619 | | - EXT2_FT_BLKDEV = 4, |
|---|
| 620 | | - EXT2_FT_FIFO = 5, |
|---|
| 621 | | - EXT2_FT_SOCK = 6, |
|---|
| 622 | | - EXT2_FT_SYMLINK = 7, |
|---|
| 623 | | - EXT2_FT_MAX |
|---|
| 624 | | -}; |
|---|
| 625 | | - |
|---|
| 626 | | -/* |
|---|
| 627 | 595 | * EXT2_DIR_PAD defines the directory entries boundaries |
|---|
| 628 | 596 | * |
|---|
| 629 | 597 | * NOTE: It must be a multiple of 4 |
|---|
| .. | .. |
|---|
| 758 | 726 | |
|---|
| 759 | 727 | /* dir.c */ |
|---|
| 760 | 728 | extern int ext2_add_link (struct dentry *, struct inode *); |
|---|
| 761 | | -extern ino_t ext2_inode_by_name(struct inode *, const struct qstr *); |
|---|
| 729 | +extern int ext2_inode_by_name(struct inode *dir, |
|---|
| 730 | + const struct qstr *child, ino_t *ino); |
|---|
| 762 | 731 | extern int ext2_make_empty(struct inode *, struct inode *); |
|---|
| 763 | 732 | extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **); |
|---|
| 764 | 733 | extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *); |
|---|
| .. | .. |
|---|
| 778 | 747 | extern void ext2_evict_inode(struct inode *); |
|---|
| 779 | 748 | extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); |
|---|
| 780 | 749 | extern int ext2_setattr (struct dentry *, struct iattr *); |
|---|
| 750 | +extern int ext2_getattr (const struct path *, struct kstat *, u32, unsigned int); |
|---|
| 781 | 751 | extern void ext2_set_inode_flags(struct inode *inode); |
|---|
| 782 | 752 | extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
|---|
| 783 | 753 | u64 start, u64 len); |
|---|
| .. | .. |
|---|
| 832 | 802 | le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block); |
|---|
| 833 | 803 | } |
|---|
| 834 | 804 | |
|---|
| 805 | +static inline ext2_fsblk_t |
|---|
| 806 | +ext2_group_last_block_no(struct super_block *sb, unsigned long group_no) |
|---|
| 807 | +{ |
|---|
| 808 | + struct ext2_sb_info *sbi = EXT2_SB(sb); |
|---|
| 809 | + |
|---|
| 810 | + if (group_no == sbi->s_groups_count - 1) |
|---|
| 811 | + return le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
|---|
| 812 | + else |
|---|
| 813 | + return ext2_group_first_block_no(sb, group_no) + |
|---|
| 814 | + EXT2_BLOCKS_PER_GROUP(sb) - 1; |
|---|
| 815 | +} |
|---|
| 816 | + |
|---|
| 835 | 817 | #define ext2_set_bit __test_and_set_bit_le |
|---|
| 836 | 818 | #define ext2_clear_bit __test_and_clear_bit_le |
|---|
| 837 | 819 | #define ext2_test_bit test_bit_le |
|---|