Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2ea3fde authored by Theodore Ts'o's avatar Theodore Ts'o
Browse files

ext4: Remove old legacy block allocator



Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 240799cd
Loading
Loading
Loading
Loading
+11 −1344

File changed.

Preview size limit exceeded, changes collapsed.

+1 −7
Original line number Diff line number Diff line
@@ -539,7 +539,6 @@ do { \
#define EXT4_MOUNT_JOURNAL_CHECKSUM	0x800000 /* Journal checksums */
#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT	0x1000000 /* Journal Async Commit */
#define EXT4_MOUNT_I_VERSION            0x2000000 /* i_version support */
#define EXT4_MOUNT_MBALLOC		0x4000000 /* Buddy allocation support */
#define EXT4_MOUNT_DELALLOC		0x8000000 /* Delalloc support */
/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
#ifndef _LINUX_EXT2_FS_H
@@ -1002,8 +1001,6 @@ extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode,
extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
					ext4_lblk_t iblock, ext4_fsblk_t goal,
					unsigned long *count, int *errp);
extern ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
			ext4_fsblk_t goal, unsigned long *count, int *errp);
extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks);
extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
					 s64 nblocks);
@@ -1018,8 +1015,6 @@ extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
						    ext4_group_t block_group,
						    struct buffer_head ** bh);
extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
extern void ext4_init_block_alloc_info(struct inode *);
extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv);

/* dir.c */
extern int ext4_check_dir_entry(const char *, struct inode *,
@@ -1054,7 +1049,7 @@ extern int ext4_mb_release(struct super_block *);
extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
				struct ext4_allocation_request *, int *);
extern int ext4_mb_reserve_blocks(struct super_block *, int);
extern void ext4_mb_discard_inode_preallocations(struct inode *);
extern void ext4_discard_preallocations(struct inode *);
extern int __init init_ext4_mballoc(void);
extern void exit_ext4_mballoc(void);
extern void ext4_mb_free_blocks(handle_t *, struct inode *,
@@ -1084,7 +1079,6 @@ extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
				struct kstat *stat);
extern void ext4_delete_inode(struct inode *);
extern int  ext4_sync_inode(handle_t *, struct inode *);
extern void ext4_discard_reservation(struct inode *);
extern void ext4_dirty_inode(struct inode *);
extern int ext4_change_inode_journal_flag(struct inode *, int);
extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
+0 −35
Original line number Diff line number Diff line
@@ -33,38 +33,6 @@ typedef __u32 ext4_lblk_t;
/* data type for block group number */
typedef unsigned long ext4_group_t;

struct ext4_reserve_window {
	ext4_fsblk_t	_rsv_start;	/* First byte reserved */
	ext4_fsblk_t	_rsv_end;	/* Last byte reserved or 0 */
};

struct ext4_reserve_window_node {
	struct rb_node		rsv_node;
	__u32			rsv_goal_size;
	__u32			rsv_alloc_hit;
	struct ext4_reserve_window	rsv_window;
};

struct ext4_block_alloc_info {
	/* information about reservation window */
	struct ext4_reserve_window_node rsv_window_node;
	/*
	 * was i_next_alloc_block in ext4_inode_info
	 * is the logical (file-relative) number of the
	 * most-recently-allocated block in this file.
	 * We use this for detecting linearly ascending allocation requests.
	 */
	ext4_lblk_t last_alloc_logical_block;
	/*
	 * Was i_next_alloc_goal in ext4_inode_info
	 * is the *physical* companion to i_next_alloc_block.
	 * it the physical block number of the block which was most-recentl
	 * allocated to this file.  This give us the goal (target) for the next
	 * allocation when we detect linearly ascending requests.
	 */
	ext4_fsblk_t last_alloc_physical_block;
};

#define rsv_start rsv_window._rsv_start
#define rsv_end rsv_window._rsv_end

@@ -97,9 +65,6 @@ struct ext4_inode_info {
	ext4_group_t	i_block_group;
	__u32	i_state;		/* Dynamic state flags for ext4 */

	/* block reservation info */
	struct ext4_block_alloc_info *i_block_alloc_info;

	ext4_lblk_t		i_dir_start_lookup;
#ifdef CONFIG_EXT4DEV_FS_XATTR
	/*
+0 −1
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ struct ext4_sb_info {
	/* root of the per fs reservation window tree */
	spinlock_t s_rsv_window_lock;
	struct rb_root s_rsv_window_root;
	struct ext4_reserve_window_node s_rsv_window_head;

	/* Journaling */
	struct inode *s_journal_inode;
+3 −6
Original line number Diff line number Diff line
@@ -2697,11 +2697,8 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
		goto out2;
	}
	/*
	 * Okay, we need to do block allocation.  Lazily initialize the block
	 * allocation info here if necessary.
	 * Okay, we need to do block allocation.
	 */
	if (S_ISREG(inode->i_mode) && (!EXT4_I(inode)->i_block_alloc_info))
		ext4_init_block_alloc_info(inode);

	/* find neighbour allocated blocks */
	ar.lleft = iblock;
@@ -2761,7 +2758,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
		/* free data blocks we just allocated */
		/* not a good idea to call discard here directly,
		 * but otherwise we'd need to call it every free() */
		ext4_mb_discard_inode_preallocations(inode);
		ext4_discard_preallocations(inode);
		ext4_free_blocks(handle, inode, ext_pblock(&newex),
					ext4_ext_get_actual_len(&newex), 0);
		goto out2;
@@ -2825,7 +2822,7 @@ void ext4_ext_truncate(struct inode *inode)
	down_write(&EXT4_I(inode)->i_data_sem);
	ext4_ext_invalidate_cache(inode);

	ext4_discard_reservation(inode);
	ext4_discard_preallocations(inode);

	/*
	 * TODO: optimization is possible here.
Loading