Blame view

fs/btrfs/raid56.h 1.72 KB
9888c3402   David Sterba   btrfs: replace GP...
1
  /* SPDX-License-Identifier: GPL-2.0 */
53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
2
3
4
  /*
   * Copyright (C) 2012 Fusion-io  All rights reserved.
   * Copyright (C) 2012 Intel Corp. All rights reserved.
53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
5
   */
9888c3402   David Sterba   btrfs: replace GP...
6
7
  #ifndef BTRFS_RAID56_H
  #define BTRFS_RAID56_H
72ad81315   David Sterba   btrfs: constify m...
8
  static inline int nr_parity_stripes(const struct map_lookup *map)
53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
9
10
11
12
13
14
15
16
  {
  	if (map->type & BTRFS_BLOCK_GROUP_RAID5)
  		return 1;
  	else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
  		return 2;
  	else
  		return 0;
  }
72ad81315   David Sterba   btrfs: constify m...
17
  static inline int nr_data_stripes(const struct map_lookup *map)
53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
18
19
20
21
22
23
24
25
  {
  	return map->num_stripes - nr_parity_stripes(map);
  }
  #define RAID5_P_STRIPE ((u64)-2)
  #define RAID6_Q_STRIPE ((u64)-1)
  
  #define is_parity_stripe(x) (((x) == RAID5_P_STRIPE) ||		\
  			     ((x) == RAID6_Q_STRIPE))
5a6ac9eac   Miao Xie   Btrfs, raid56: su...
26
27
  struct btrfs_raid_bio;
  struct btrfs_device;
2ff7e61e0   Jeff Mahoney   btrfs: take an fs...
28
  int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio,
8e5cfb55d   Zhao Lei   Btrfs: Make raid_...
29
30
  			  struct btrfs_bio *bbio, u64 stripe_len,
  			  int mirror_num, int generic_io);
2ff7e61e0   Jeff Mahoney   btrfs: take an fs...
31
  int raid56_parity_write(struct btrfs_fs_info *fs_info, struct bio *bio,
8e5cfb55d   Zhao Lei   Btrfs: Make raid_...
32
  			       struct btrfs_bio *bbio, u64 stripe_len);
53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
33

b4ee17826   Omar Sandoval   Btrfs: add RAID 5...
34
35
  void raid56_add_scrub_pages(struct btrfs_raid_bio *rbio, struct page *page,
  			    u64 logical);
5a6ac9eac   Miao Xie   Btrfs, raid56: su...
36
  struct btrfs_raid_bio *
2ff7e61e0   Jeff Mahoney   btrfs: take an fs...
37
  raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,
8e5cfb55d   Zhao Lei   Btrfs: Make raid_...
38
39
  			       struct btrfs_bio *bbio, u64 stripe_len,
  			       struct btrfs_device *scrub_dev,
5a6ac9eac   Miao Xie   Btrfs, raid56: su...
40
  			       unsigned long *dbitmap, int stripe_nsectors);
5a6ac9eac   Miao Xie   Btrfs, raid56: su...
41
  void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio);
b4ee17826   Omar Sandoval   Btrfs: add RAID 5...
42
  struct btrfs_raid_bio *
2ff7e61e0   Jeff Mahoney   btrfs: take an fs...
43
  raid56_alloc_missing_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,
b4ee17826   Omar Sandoval   Btrfs: add RAID 5...
44
45
  			  struct btrfs_bio *bbio, u64 length);
  void raid56_submit_missing_rbio(struct btrfs_raid_bio *rbio);
53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
46
47
  int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
9888c3402   David Sterba   btrfs: replace GP...
48

53b381b3a   David Woodhouse   Btrfs: RAID5 and ...
49
  #endif