Skip to content

Commit 57a5df0

Browse files
Jakob-Koschelidryomov
authored andcommitted
ceph: use dedicated list iterator variable
To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 7ffe4fc commit 57a5df0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/ceph/caps.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,
15771577

15781578
while (first_tid <= last_tid) {
15791579
struct ceph_cap *cap = ci->i_auth_cap;
1580-
struct ceph_cap_flush *cf;
1580+
struct ceph_cap_flush *cf = NULL, *iter;
15811581
int ret;
15821582

15831583
if (!(cap && cap->session == session)) {
@@ -1587,8 +1587,9 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,
15871587
}
15881588

15891589
ret = -ENOENT;
1590-
list_for_each_entry(cf, &ci->i_cap_flush_list, i_list) {
1591-
if (cf->tid >= first_tid) {
1590+
list_for_each_entry(iter, &ci->i_cap_flush_list, i_list) {
1591+
if (iter->tid >= first_tid) {
1592+
cf = iter;
15921593
ret = 0;
15931594
break;
15941595
}

0 commit comments

Comments
 (0)