From c68d2fb82b01f79a41ab76c40cb576e966484fd7 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 17 Dec 2018 10:49:53 +1100 Subject: [PATCH] LU-9679 osc: convert while to for in get_write_extents() This 'while' loop is really a 'for' loop in disguise. So change it to 'for'. Linux-Commit: d3ba9dc5cc66 ("lustre: osc_cache: convert while to for in get_write_extents()") Signed-off-by: Mr NeilBrown Change-Id: Ifd4295cbdad400d2c49d83e0c54ddd0e4c5ae548 Reviewed-on: https://review.whamcloud.com/37608 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Reviewed-by: James Simmons --- lustre/osc/osc_cache.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 884d14c..b74736c 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -2026,19 +2026,16 @@ static unsigned int get_write_extents(struct osc_object *obj, if (data.erd_page_count == data.erd_max_pages) return data.erd_page_count; - ext = first_extent(obj); - while (ext != NULL) { + 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 != NULL)) { - 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; } -- 1.8.3.1