Add retrieval of the filesystem's generation to the fsinfo ioctl. This is
driven by setting the BTRFS_FS_INFO_FLAG_GENERATION flag in
btrfs_ioctl_fs_info_args::flags.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
                fi_args->flags |= BTRFS_FS_INFO_FLAG_CSUM_INFO;
        }
 
+       if (flags_in & BTRFS_FS_INFO_FLAG_GENERATION) {
+               fi_args->generation = fs_info->generation;
+               fi_args->flags |= BTRFS_FS_INFO_FLAG_GENERATION;
+       }
+
        if (copy_to_user(arg, fi_args, sizeof(*fi_args)))
                ret = -EFAULT;
 
 
 /* Request information about checksum type and size */
 #define BTRFS_FS_INFO_FLAG_CSUM_INFO                   (1 << 0)
 
+/* Request information about filesystem generation */
+#define BTRFS_FS_INFO_FLAG_GENERATION                  (1 << 1)
+
 struct btrfs_ioctl_fs_info_args {
        __u64 max_id;                           /* out */
        __u64 num_devices;                      /* out */
        __u16 csum_type;                        /* out */
        __u16 csum_size;                        /* out */
        __u64 flags;                            /* in/out */
-       __u8 reserved[968];                     /* pad to 1k */
+       __u64 generation;                       /* out */
+       __u8 reserved[960];                     /* pad to 1k */
 };
 
 /*