hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/ext2/ext2.h
....@@ -52,8 +52,8 @@
5252 /*
5353 * Was i_next_alloc_goal in ext2_inode_info
5454 * 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
5757 * allocation when we detect linearly ascending requests.
5858 */
5959 ext2_fsblk_t last_alloc_physical_block;
....@@ -68,10 +68,7 @@
6868 * second extended-fs super-block data in memory
6969 */
7070 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 */
7371 unsigned long s_inodes_per_block;/* Number of inodes per block */
74
- unsigned long s_frags_per_group;/* Number of fragments in a group */
7572 unsigned long s_blocks_per_group;/* Number of blocks in a group */
7673 unsigned long s_inodes_per_group;/* Number of inodes in a group */
7774 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
....@@ -177,21 +174,13 @@
177174 #define EXT2_MIN_BLOCK_SIZE 1024
178175 #define EXT2_MAX_BLOCK_SIZE 4096
179176 #define EXT2_MIN_BLOCK_LOG_SIZE 10
177
+#define EXT2_MAX_BLOCK_LOG_SIZE 16
180178 #define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
181179 #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
182180 #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
183181 #define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
184182 #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
185183 #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)
195184
196185 /*
197186 * Structure of a blocks group descriptor
....@@ -374,7 +363,6 @@
374363 /*
375364 * Mount flags
376365 */
377
-#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
378366 #define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
379367 #define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
380368 #define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
....@@ -390,11 +378,7 @@
390378 #define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
391379 #define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
392380 #define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
393
-#ifdef CONFIG_FS_DAX
394381 #define EXT2_MOUNT_DAX 0x100000 /* Direct Access */
395
-#else
396
-#define EXT2_MOUNT_DAX 0
397
-#endif
398382
399383
400384 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
....@@ -608,22 +592,6 @@
608592 };
609593
610594 /*
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
-/*
627595 * EXT2_DIR_PAD defines the directory entries boundaries
628596 *
629597 * NOTE: It must be a multiple of 4
....@@ -758,7 +726,8 @@
758726
759727 /* dir.c */
760728 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);
762731 extern int ext2_make_empty(struct inode *, struct inode *);
763732 extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **);
764733 extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
....@@ -778,6 +747,7 @@
778747 extern void ext2_evict_inode(struct inode *);
779748 extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
780749 extern int ext2_setattr (struct dentry *, struct iattr *);
750
+extern int ext2_getattr (const struct path *, struct kstat *, u32, unsigned int);
781751 extern void ext2_set_inode_flags(struct inode *inode);
782752 extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
783753 u64 start, u64 len);
....@@ -832,6 +802,18 @@
832802 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
833803 }
834804
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
+
835817 #define ext2_set_bit __test_and_set_bit_le
836818 #define ext2_clear_bit __test_and_clear_bit_le
837819 #define ext2_test_bit test_bit_le