From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755350AbbFLRSD (ORCPT ); Fri, 12 Jun 2015 13:18:03 -0400 Received: from smtprelay0033.hostedemail.com ([216.40.44.33]:59960 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752890AbbFLRSB (ORCPT ); Fri, 12 Jun 2015 13:18:01 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:960:966:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3866:3867:3872:4321:4385:5007:6119:6261:7904:10004:10400:10848:11026:11232:11658:11914:12043:12114:12438:12517:12519:12740:13019:13069:13255:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: lunch42_45aef12979841 X-Filterd-Recvd-Size: 1977 Message-ID: <1434129477.2972.38.camel@perches.com> Subject: Re: [PATCH 1/1 linux-next] pnfs/flexfiles: use swap() in ff_layout_sort_mirrors() From: Joe Perches To: Fabian Frederick Cc: linux-kernel@vger.kernel.org, Julia Lawall , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Date: Fri, 12 Jun 2015 10:17:57 -0700 In-Reply-To: <1434128330-10253-1-git-send-email-fabf@skynet.be> References: <1434128330-10253-1-git-send-email-fabf@skynet.be> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-06-12 at 18:58 +0200, Fabian Frederick wrote: > Use kernel.h macro definition. A lot of these conversions seem to be for bubble sorts. Maybe it'd be useful to add a generic one somewhere. > diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c [] > @@ -182,17 +182,14 @@ static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls) > > static void ff_layout_sort_mirrors(struct nfs4_ff_layout_segment *fls) > { > - struct nfs4_ff_layout_mirror *tmp; > int i, j; > > for (i = 0; i < fls->mirror_array_cnt - 1; i++) { > for (j = i + 1; j < fls->mirror_array_cnt; j++) > if (fls->mirror_array[i]->efficiency < > - fls->mirror_array[j]->efficiency) { > - tmp = fls->mirror_array[i]; > - fls->mirror_array[i] = fls->mirror_array[j]; > - fls->mirror_array[j] = tmp; > - } > + fls->mirror_array[j]->efficiency) > + swap(fls->mirror_array[i], > + fls->mirror_array[j]); > } > } >