diff mbox series

[19/29] lustre: osc_cache: convert while to for in get_write_extents()

Message ID 154701504232.26726.5168102908572630267.stgit@noble (mailing list archive)
State New, archived
Headers show
Series assorted osc cleanups. | expand

Commit Message

NeilBrown Jan. 9, 2019, 6:24 a.m. UTC
This 'while' loop is really a 'for' loop in disguise.
So change it to 'for'.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/staging/lustre/lustre/osc/osc_cache.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index 5666f384ac6c..db28cc4d5ae8 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -2012,19 +2012,16 @@  static unsigned int get_write_extents(struct osc_object *obj,
 			break;
 	}
 
-	ext = first_extent(obj);
-	while (ext) {
+	for (ext = first_extent(obj);
+	     ext;
+	     ext = next_extent(ext)) {
 		if ((ext->oe_state != OES_CACHE) ||
 		    /* this extent may be already in current rpclist */
-		    (!list_empty(&ext->oe_link) && ext->oe_owner)) {
-			ext = next_extent(ext);
+		    (!list_empty(&ext->oe_link) && ext->oe_owner))
 			continue;
-		}
 
 		if (!try_to_add_extent_for_io(cli, ext, &data))
 			return data.erd_page_count;
-
-		ext = next_extent(ext);
 	}
 	return data.erd_page_count;
 }