public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org, Julia Lawall <Julia.Lawall@lip6.fr>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1 linux-next] pnfs/flexfiles: use swap() in ff_layout_sort_mirrors()
Date: Fri, 12 Jun 2015 10:17:57 -0700	[thread overview]
Message-ID: <1434129477.2972.38.camel@perches.com> (raw)
In-Reply-To: <1434128330-10253-1-git-send-email-fabf@skynet.be>

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]);
>  	}
>  }
>  




  reply	other threads:[~2015-06-12 17:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 16:58 [PATCH 1/1 linux-next] pnfs/flexfiles: use swap() in ff_layout_sort_mirrors() Fabian Frederick
2015-06-12 17:17 ` Joe Perches [this message]
2015-06-14  5:23   ` Fabian Frederick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434129477.2972.38.camel@perches.com \
    --to=joe@perches.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=anna.schumaker@netapp.com \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox