buckets.h (1f2f92ec3f2e5802c2870d0d34ccfa66ae9216ad) | buckets.h (3858aa4268b2f71827097f548879e4405b4cc995) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Code for manipulating bucket marks for garbage collection. 4 * 5 * Copyright 2014 Datera, Inc. 6 */ 7 8#ifndef _BUCKETS_H --- 156 unchanged lines hidden (view full) --- 165 166static inline int gen_after(u8 a, u8 b) 167{ 168 int r = gen_cmp(a, b); 169 170 return r > 0 ? r : 0; 171} 172 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Code for manipulating bucket marks for garbage collection. 4 * 5 * Copyright 2014 Datera, Inc. 6 */ 7 8#ifndef _BUCKETS_H --- 156 unchanged lines hidden (view full) --- 165 166static inline int gen_after(u8 a, u8 b) 167{ 168 int r = gen_cmp(a, b); 169 170 return r > 0 ? r : 0; 171} 172 |
173static inline u8 dev_ptr_stale_rcu(struct bch_dev *ca, const struct bch_extent_ptr *ptr) 174{ 175 return gen_after(*bucket_gen(ca, PTR_BUCKET_NR(ca, ptr)), ptr->gen); 176} 177 |
|
173/** | 178/** |
174 * ptr_stale() - check if a pointer points into a bucket that has been | 179 * dev_ptr_stale() - check if a pointer points into a bucket that has been |
175 * invalidated. 176 */ | 180 * invalidated. 181 */ |
177static inline u8 ptr_stale(struct bch_dev *ca, 178 const struct bch_extent_ptr *ptr) | 182static inline u8 dev_ptr_stale(struct bch_dev *ca, const struct bch_extent_ptr *ptr) |
179{ | 183{ |
180 u8 ret; 181 | |
182 rcu_read_lock(); | 184 rcu_read_lock(); |
183 ret = gen_after(*bucket_gen(ca, PTR_BUCKET_NR(ca, ptr)), ptr->gen); | 185 u8 ret = dev_ptr_stale_rcu(ca, ptr); |
184 rcu_read_unlock(); 185 186 return ret; 187} 188 189/* Device usage: */ 190 191void bch2_dev_usage_read_fast(struct bch_dev *, struct bch_dev_usage *); --- 282 unchanged lines hidden --- | 186 rcu_read_unlock(); 187 188 return ret; 189} 190 191/* Device usage: */ 192 193void bch2_dev_usage_read_fast(struct bch_dev *, struct bch_dev_usage *); --- 282 unchanged lines hidden --- |