pnfs/flexfiles: use swap() in ff_layout_sort_mirrors()
authorFabian Frederick <fabf@skynet.be>
Fri, 12 Jun 2015 16:58:50 +0000 (18:58 +0200)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 16 Jun 2015 15:14:03 +0000 (11:14 -0400)
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/flexfilelayout/flexfilelayout.c

index 7d05089e52d6c8b7a29e92e80011bdee0e06a32c..0f1410c94827e95d1985eba0cd4b7f42d42712ee 100644 (file)
@@ -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]);
        }
 }