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

Commit fd0b57f1 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

Revert "writeback: Avoid skipping inode writeback"

This reverts commit 83af290d0975eda561a0599f54991c62842a8a99.
parent 2aedb8ff
Loading
Loading
Loading
Loading
+10 −29
Original line number Diff line number Diff line
@@ -160,9 +160,7 @@ static void inode_io_list_del_locked(struct inode *inode,
				     struct bdi_writeback *wb)
{
	assert_spin_locked(&wb->list_lock);
	assert_spin_locked(&inode->i_lock);

	inode->i_state &= ~I_SYNC_QUEUED;
	list_del_init(&inode->i_io_list);
	wb_io_lists_depopulated(wb);
}
@@ -996,9 +994,7 @@ void inode_io_list_del(struct inode *inode)
	struct bdi_writeback *wb;

	wb = inode_to_wb_and_lock_list(inode);
	spin_lock(&inode->i_lock);
	inode_io_list_del_locked(inode, wb);
	spin_unlock(&inode->i_lock);
	spin_unlock(&wb->list_lock);
}

@@ -1047,9 +1043,8 @@ void sb_clear_inode_writeback(struct inode *inode)
 * the case then the inode must have been redirtied while it was being written
 * out and we don't reset its dirtied_when.
 */
static void __redirty_tail(struct inode *inode, struct bdi_writeback *wb)
static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
{
	assert_spin_locked(&inode->i_lock);
	if (!list_empty(&wb->b_dirty)) {
		struct inode *tail;

@@ -1058,14 +1053,6 @@ static void __redirty_tail(struct inode *inode, struct bdi_writeback *wb)
			inode->dirtied_when = jiffies;
	}
	inode_io_list_move_locked(inode, wb, &wb->b_dirty);
	inode->i_state &= ~I_SYNC_QUEUED;
}

static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
{
	spin_lock(&inode->i_lock);
	__redirty_tail(inode, wb);
	spin_unlock(&inode->i_lock);
}

/*
@@ -1134,11 +1121,8 @@ static int move_expired_inodes(struct list_head *delaying_queue,
			break;
		list_move(&inode->i_io_list, &tmp);
		moved++;
		spin_lock(&inode->i_lock);
		if (flags & EXPIRE_DIRTY_ATIME)
			inode->i_state |= I_DIRTY_TIME_EXPIRED;
		inode->i_state |= I_SYNC_QUEUED;
		spin_unlock(&inode->i_lock);
			set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state);
		if (sb_is_blkdev_sb(inode->i_sb))
			continue;
		if (sb && sb != inode->i_sb)
@@ -1281,7 +1265,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
		 * writeback is not making progress due to locked
		 * buffers. Skip this inode for now.
		 */
		__redirty_tail(inode, wb);
		redirty_tail(inode, wb);
		return;
	}

@@ -1301,7 +1285,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
			 * retrying writeback of the dirty page/inode
			 * that cannot be performed immediately.
			 */
			__redirty_tail(inode, wb);
			redirty_tail(inode, wb);
		}
	} else if (inode->i_state & I_DIRTY) {
		/*
@@ -1309,11 +1293,10 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
		 * such as delayed allocation during submission or metadata
		 * updates after data IO completion.
		 */
		__redirty_tail(inode, wb);
		redirty_tail(inode, wb);
	} else if (inode->i_state & I_DIRTY_TIME) {
		inode->dirtied_when = jiffies;
		inode_io_list_move_locked(inode, wb, &wb->b_dirty_time);
		inode->i_state &= ~I_SYNC_QUEUED;
	} else {
		/* The inode is clean. Remove from writeback lists. */
		inode_io_list_del_locked(inode, wb);
@@ -1557,9 +1540,8 @@ static long writeback_sb_inodes(struct super_block *sb,
		 */
		spin_lock(&inode->i_lock);
		if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
			inode->i_state &= ~I_SYNC_QUEUED;
			__redirty_tail(inode, wb);
			spin_unlock(&inode->i_lock);
			redirty_tail(inode, wb);
			continue;
		}
		if ((inode->i_state & I_SYNC) && wbc.sync_mode != WB_SYNC_ALL) {
@@ -2178,12 +2160,11 @@ void __mark_inode_dirty(struct inode *inode, int flags)
		inode->i_state |= flags;

		/*
		 * If the inode is queued for writeback by flush worker, just
		 * update its dirty state. Once the flush worker is done with
		 * the inode it will place it on the appropriate superblock
		 * list, based upon its state.
		 * If the inode is being synced, just update its dirty state.
		 * The unlocker will place the inode on the appropriate
		 * superblock list, based upon its state.
		 */
		if (inode->i_state & I_SYNC_QUEUED)
		if (inode->i_state & I_SYNC)
			goto out_unlock_inode;

		/*
+2 −6
Original line number Diff line number Diff line
@@ -2051,10 +2051,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
 *
 * I_CREATING		New object's inode in the middle of setting up.
 *
 * I_SYNC_QUEUED	Inode is queued in b_io or b_more_io writeback lists.
 *			Used to detect that mark_inode_dirty() should not move
 * 			inode between dirty lists.
 *
 * Q: What is the difference between I_WILL_FREE and I_FREEING?
 */
#define I_DIRTY_SYNC		(1 << 0)
@@ -2072,11 +2068,11 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
#define I_DIO_WAKEUP		(1 << __I_DIO_WAKEUP)
#define I_LINKABLE		(1 << 10)
#define I_DIRTY_TIME		(1 << 11)
#define I_DIRTY_TIME_EXPIRED	(1 << 12)
#define __I_DIRTY_TIME_EXPIRED	12
#define I_DIRTY_TIME_EXPIRED	(1 << __I_DIRTY_TIME_EXPIRED)
#define I_WB_SWITCH		(1 << 13)
#define I_OVL_INUSE		(1 << 14)
#define I_CREATING		(1 << 15)
#define I_SYNC_QUEUED		(1 << 16)

#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)