From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abhijith Das Date: Wed, 8 Aug 2018 17:59:29 -0400 (EDT) Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Simplify iterative add loop in foreach_descriptor In-Reply-To: <183182471.770089.1533754323408.JavaMail.zimbra@redhat.com> References: <183182471.770089.1533754323408.JavaMail.zimbra@redhat.com> Message-ID: <136577368.55746140.1533765569892.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > From: "Bob Peterson" > To: "cluster-devel" > Sent: Wednesday, August 8, 2018 1:52:03 PM > Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Simplify iterative add loop in foreach_descriptor > > Hi, > > Before this patch, function foreach_descriptor repeatedly called > function gfs2_replay_incr_blk which just incremented the value while > decrementing another, and checked for wrap. This is a waste of time. > This patch just adds the value and adjusts it if a wrap occurred. > > Signed-off-by: Bob Peterson Hi, Looks good. ACK. Cheers! --Abhi Reviewed-by: Abhi Das > --- > fs/gfs2/recovery.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c > index 0f501f938d1c..6c6b19263b82 100644 > --- a/fs/gfs2/recovery.c > +++ b/fs/gfs2/recovery.c > @@ -354,8 +354,9 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, > unsigned int start, > return error; > } > > - while (length--) > - gfs2_replay_incr_blk(jd, &start); > + start += length; > + if (start >= jd->jd_blocks) > + start -= jd->jd_blocks; > > brelse(bh); > } > >