]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/alloc_background.h
Update bcachefs sources to 2272c5f5b7 bcachefs: Mark stripe buckets with correct...
[bcachefs-tools-debian] / libbcachefs / alloc_background.h
index 96ac8f396d4669966e017904406e49f41ca97271..1aa7c7a023b3d5f7839adc2759bc6d649adb028f 100644 (file)
@@ -44,10 +44,10 @@ static inline enum bch_data_type __alloc_data_type(u32 dirty_sectors,
                                                   struct bch_alloc_v4 a,
                                                   enum bch_data_type data_type)
 {
+       if (stripe)
+               return data_type == BCH_DATA_parity ? data_type : BCH_DATA_stripe;
        if (dirty_sectors)
                return data_type;
-       if (stripe)
-               return BCH_DATA_stripe;
        if (cached_sectors)
                return BCH_DATA_cached;
        if (BCH_ALLOC_V4_NEED_DISCARD(&a))
@@ -64,6 +64,11 @@ static inline enum bch_data_type alloc_data_type(struct bch_alloc_v4 a,
                                 a.stripe, a, data_type);
 }
 
+static inline enum bch_data_type bucket_data_type(enum bch_data_type data_type)
+{
+       return data_type == BCH_DATA_stripe ? BCH_DATA_user : data_type;
+}
+
 static inline u64 alloc_lru_idx_read(struct bch_alloc_v4 a)
 {
        return a.data_type == BCH_DATA_cached ? a.io_time[READ] : 0;