提交 f9650845 编写于 作者: V Veaceslav Falico 提交者: David S. Miller

bonding: don't use bond_next_slave() in bond_info_seq_next()

We don't need the circular loop there and it's the only current user of
bond_next_slave() - so just use the standard bond_for_each_slave().

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: NVeaceslav Falico <vfalico@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 da8f0919
...@@ -31,17 +31,25 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) ...@@ -31,17 +31,25 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
struct bonding *bond = seq->private; struct bonding *bond = seq->private;
struct slave *slave = v; struct list_head *iter;
struct slave *slave;
bool found = false;
++*pos; ++*pos;
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
return bond_first_slave(bond); return bond_first_slave(bond);
if (bond_is_last_slave(bond, slave)) if (bond_is_last_slave(bond, v))
return NULL; return NULL;
slave = bond_next_slave(bond, slave);
return slave; bond_for_each_slave(bond, slave, iter) {
if (found)
return slave;
if (slave == v)
found = true;
}
return NULL;
} }
static void bond_info_seq_stop(struct seq_file *seq, void *v) static void bond_info_seq_stop(struct seq_file *seq, void *v)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册