btrfs: move check for device generation to the last
authorAnand Jain <anand.jain@oracle.com>
Thu, 9 Nov 2017 15:45:25 +0000 (23:45 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Jan 2018 15:08:13 +0000 (16:08 +0100)
No functional changes. This helps to move the entire section into
a new function.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 51445cc496c0b06922052bff15caf7526581e91c..04d2052266560b6b6e2b60d4a91a1feea39e4910 100644 (file)
@@ -1044,9 +1044,6 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
                        goto error_brelse;
 
                device->generation = btrfs_super_generation(disk_super);
-               if (!latest_dev ||
-                   device->generation > latest_dev->generation)
-                       latest_dev = device;
 
                if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING) {
                        device->writeable = 0;
@@ -1073,6 +1070,11 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
                                 &fs_devices->alloc_list);
                }
                brelse(bh);
+
+               if (!latest_dev ||
+                   device->generation > latest_dev->generation)
+                       latest_dev = device;
+
                continue;
 
 error_brelse: