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

Commit 137526cb authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

Revert "writeback: Avoid skipping inode writeback"

This reverts commit 25078e97.
parent 3cec603f
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);
}
@@ -992,9 +990,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);
}

@@ -1043,9 +1039,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;

@@ -1054,14 +1049,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);
}

/*
@@ -1130,11 +1117,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)
@@ -1277,7 +1261,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;
	}

@@ -1297,7 +1281,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) {
		/*
@@ -1305,11 +1289,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);
@@ -1553,9 +1536,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) {
@@ -2145,12 +2127,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;

		/*
+1 −6
Original line number Diff line number Diff line
@@ -1997,10 +1997,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
 * I_OVL_INUSE		Used by overlayfs to get exclusive ownership on upper
 *			and work dirs among overlayfs mounts.
 *
 * 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)
@@ -2022,7 +2018,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
#define I_DIRTY_TIME_EXPIRED	(1 << __I_DIRTY_TIME_EXPIRED)
#define I_WB_SWITCH		(1 << 13)
#define I_OVL_INUSE			(1 << 14)
#define I_SYNC_QUEUED		(1 << 16)

#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
#define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)