Skip to content

Commit

Permalink
inode: rename i_wb_list to i_io_list
Browse files Browse the repository at this point in the history
There's a small consistency problem between the inode and writeback
naming. Writeback calls the "for IO" inode queues b_io and
b_more_io, but the inode calls these the "writeback list" or
i_wb_list. This makes it hard to an new "under writeback" list to
the inode, or call it an "under IO" list on the bdi because either
way we'll have writeback on IO and IO on writeback and it'll just be
confusing. I'm getting confused just writing this!

So, rename the inode "for IO" list variable to i_io_list so we can
add a new "writeback list" in a subsequent patch.

Signed-off-by: Dave Chinner <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Tested-by: Dave Chinner <[email protected]>
  • Loading branch information
Dave Chinner authored and Josef Bacik committed Aug 18, 2015
1 parent e97fedb commit c7f5408
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
46 changes: 23 additions & 23 deletions fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ unsigned int dirtytime_expire_interval = 12 * 60 * 60;

static inline struct inode *wb_inode(struct list_head *head)
{
return list_entry(head, struct inode, i_wb_list);
return list_entry(head, struct inode, i_io_list);
}

/*
Expand Down Expand Up @@ -125,22 +125,22 @@ static void wb_io_lists_depopulated(struct bdi_writeback *wb)
}

/**
* inode_wb_list_move_locked - move an inode onto a bdi_writeback IO list
* inode_io_list_move_locked - move an inode onto a bdi_writeback IO list
* @inode: inode to be moved
* @wb: target bdi_writeback
* @head: one of @wb->b_{dirty|io|more_io}
*
* Move @inode->i_wb_list to @list of @wb and set %WB_has_dirty_io.
* Move @inode->i_io_list to @list of @wb and set %WB_has_dirty_io.
* Returns %true if @inode is the first occupant of the !dirty_time IO
* lists; otherwise, %false.
*/
static bool inode_wb_list_move_locked(struct inode *inode,
static bool inode_io_list_move_locked(struct inode *inode,
struct bdi_writeback *wb,
struct list_head *head)
{
assert_spin_locked(&wb->list_lock);

list_move(&inode->i_wb_list, head);
list_move(&inode->i_io_list, head);

/* dirty_time doesn't count as dirty_io until expiration */
if (head != &wb->b_dirty_time)
Expand All @@ -151,19 +151,19 @@ static bool inode_wb_list_move_locked(struct inode *inode,
}

/**
* inode_wb_list_del_locked - remove an inode from its bdi_writeback IO list
* inode_io_list_del_locked - remove an inode from its bdi_writeback IO list
* @inode: inode to be removed
* @wb: bdi_writeback @inode is being removed from
*
* Remove @inode which may be on one of @wb->b_{dirty|io|more_io} lists and
* clear %WB_has_dirty_io if all are empty afterwards.
*/
static void inode_wb_list_del_locked(struct inode *inode,
static void inode_io_list_del_locked(struct inode *inode,
struct bdi_writeback *wb)
{
assert_spin_locked(&wb->list_lock);

list_del_init(&inode->i_wb_list);
list_del_init(&inode->i_io_list);
wb_io_lists_depopulated(wb);
}

Expand Down Expand Up @@ -351,7 +351,7 @@ static void inode_switch_wbs_work_fn(struct work_struct *work)

/*
* Once I_FREEING is visible under i_lock, the eviction path owns
* the inode and we shouldn't modify ->i_wb_list.
* the inode and we shouldn't modify ->i_io_list.
*/
if (unlikely(inode->i_state & I_FREEING))
goto skip_switch;
Expand Down Expand Up @@ -390,16 +390,16 @@ static void inode_switch_wbs_work_fn(struct work_struct *work)
* is always correct including from ->b_dirty_time. The transfer
* preserves @inode->dirtied_when ordering.
*/
if (!list_empty(&inode->i_wb_list)) {
if (!list_empty(&inode->i_io_list)) {
struct inode *pos;

inode_wb_list_del_locked(inode, old_wb);
inode_io_list_del_locked(inode, old_wb);
inode->i_wb = new_wb;
list_for_each_entry(pos, &new_wb->b_dirty, i_wb_list)
list_for_each_entry(pos, &new_wb->b_dirty, i_io_list)
if (time_after_eq(inode->dirtied_when,
pos->dirtied_when))
break;
inode_wb_list_move_locked(inode, new_wb, pos->i_wb_list.prev);
inode_io_list_move_locked(inode, new_wb, pos->i_io_list.prev);
} else {
inode->i_wb = new_wb;
}
Expand Down Expand Up @@ -961,12 +961,12 @@ void wb_start_background_writeback(struct bdi_writeback *wb)
/*
* Remove the inode from the writeback list it is on.
*/
void inode_wb_list_del(struct inode *inode)
void inode_io_list_del(struct inode *inode)
{
struct bdi_writeback *wb;

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

Expand All @@ -988,15 +988,15 @@ static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
if (time_before(inode->dirtied_when, tail->dirtied_when))
inode->dirtied_when = jiffies;
}
inode_wb_list_move_locked(inode, wb, &wb->b_dirty);
inode_io_list_move_locked(inode, wb, &wb->b_dirty);
}

/*
* requeue inode for re-scanning after bdi->b_io list is exhausted.
*/
static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
{
inode_wb_list_move_locked(inode, wb, &wb->b_more_io);
inode_io_list_move_locked(inode, wb, &wb->b_more_io);
}

static void inode_sync_complete(struct inode *inode)
Expand Down Expand Up @@ -1055,7 +1055,7 @@ static int move_expired_inodes(struct list_head *delaying_queue,
if (older_than_this &&
inode_dirtied_after(inode, *older_than_this))
break;
list_move(&inode->i_wb_list, &tmp);
list_move(&inode->i_io_list, &tmp);
moved++;
if (flags & EXPIRE_DIRTY_ATIME)
set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state);
Expand All @@ -1078,7 +1078,7 @@ static int move_expired_inodes(struct list_head *delaying_queue,
list_for_each_prev_safe(pos, node, &tmp) {
inode = wb_inode(pos);
if (inode->i_sb == sb)
list_move(&inode->i_wb_list, dispatch_queue);
list_move(&inode->i_io_list, dispatch_queue);
}
}
out:
Expand Down Expand Up @@ -1232,10 +1232,10 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
redirty_tail(inode, wb);
} else if (inode->i_state & I_DIRTY_TIME) {
inode->dirtied_when = jiffies;
inode_wb_list_move_locked(inode, wb, &wb->b_dirty_time);
inode_io_list_move_locked(inode, wb, &wb->b_dirty_time);
} else {
/* The inode is clean. Remove from writeback lists. */
inode_wb_list_del_locked(inode, wb);
inode_io_list_del_locked(inode, wb);
}
}

Expand Down Expand Up @@ -1378,7 +1378,7 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
* touch it. See comment above for explanation.
*/
if (!(inode->i_state & I_DIRTY_ALL))
inode_wb_list_del_locked(inode, wb);
inode_io_list_del_locked(inode, wb);
spin_unlock(&wb->list_lock);
inode_sync_complete(inode);
out:
Expand Down Expand Up @@ -2091,7 +2091,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
else
dirty_list = &wb->b_dirty_time;

wakeup_bdi = inode_wb_list_move_locked(inode, wb,
wakeup_bdi = inode_io_list_move_locked(inode, wb,
dirty_list);

spin_unlock(&wb->list_lock);
Expand Down
8 changes: 4 additions & 4 deletions fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* inode->i_sb->s_inode_list_lock protects:
* inode->i_sb->s_inodes, inode->i_sb_list
* bdi->wb.list_lock protects:
* bdi->wb.b_{dirty,io,more_io,dirty_time}, inode->i_wb_list
* bdi->wb.b_{dirty,io,more_io,dirty_time}, inode->i_io_list
* inode_hash_lock protects:
* inode_hashtable, inode->i_hash
*
Expand Down Expand Up @@ -357,7 +357,7 @@ void inode_init_once(struct inode *inode)
memset(inode, 0, sizeof(*inode));
INIT_HLIST_NODE(&inode->i_hash);
INIT_LIST_HEAD(&inode->i_devices);
INIT_LIST_HEAD(&inode->i_wb_list);
INIT_LIST_HEAD(&inode->i_io_list);
INIT_LIST_HEAD(&inode->i_lru);
address_space_init_once(&inode->i_data);
i_size_ordered_init(inode);
Expand Down Expand Up @@ -525,8 +525,8 @@ static void evict(struct inode *inode)
BUG_ON(!(inode->i_state & I_FREEING));
BUG_ON(!list_empty(&inode->i_lru));

if (!list_empty(&inode->i_wb_list))
inode_wb_list_del(inode);
if (!list_empty(&inode->i_io_list))
inode_io_list_del(inode);

inode_sb_list_del(inode);

Expand Down
2 changes: 1 addition & 1 deletion fs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ extern void inode_add_lru(struct inode *inode);
/*
* fs-writeback.c
*/
extern void inode_wb_list_del(struct inode *inode);
extern void inode_io_list_del(struct inode *inode);

extern long get_nr_dirty_inodes(void);
extern void evict_inodes(struct super_block *);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ struct inode {
unsigned long dirtied_time_when;

struct hlist_node i_hash;
struct list_head i_wb_list; /* backing dev IO list */
struct list_head i_io_list; /* backing dev IO list */
#ifdef CONFIG_CGROUP_WRITEBACK
struct bdi_writeback *i_wb; /* the associated cgroup wb */

Expand Down
8 changes: 4 additions & 4 deletions mm/backing-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)

nr_dirty = nr_io = nr_more_io = nr_dirty_time = 0;
spin_lock(&wb->list_lock);
list_for_each_entry(inode, &wb->b_dirty, i_wb_list)
list_for_each_entry(inode, &wb->b_dirty, i_io_list)
nr_dirty++;
list_for_each_entry(inode, &wb->b_io, i_wb_list)
list_for_each_entry(inode, &wb->b_io, i_io_list)
nr_io++;
list_for_each_entry(inode, &wb->b_more_io, i_wb_list)
list_for_each_entry(inode, &wb->b_more_io, i_io_list)
nr_more_io++;
list_for_each_entry(inode, &wb->b_dirty_time, i_wb_list)
list_for_each_entry(inode, &wb->b_dirty_time, i_io_list)
if (inode->i_state & I_DIRTY_TIME)
nr_dirty_time++;
spin_unlock(&wb->list_lock);
Expand Down

0 comments on commit c7f5408

Please sign in to comment.