~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/bcachefs/btree_key_cache.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _BCACHEFS_BTREE_KEY_CACHE_H
  3 #define _BCACHEFS_BTREE_KEY_CACHE_H
  4 
  5 static inline size_t bch2_nr_btree_keys_need_flush(struct bch_fs *c)
  6 {
  7         size_t nr_dirty = atomic_long_read(&c->btree_key_cache.nr_dirty);
  8         size_t nr_keys = atomic_long_read(&c->btree_key_cache.nr_keys);
  9         size_t max_dirty = 1024 + nr_keys  / 2;
 10 
 11         return max_t(ssize_t, 0, nr_dirty - max_dirty);
 12 }
 13 
 14 static inline bool bch2_btree_key_cache_must_wait(struct bch_fs *c)
 15 {
 16         size_t nr_dirty = atomic_long_read(&c->btree_key_cache.nr_dirty);
 17         size_t nr_keys = atomic_long_read(&c->btree_key_cache.nr_keys);
 18         size_t max_dirty = 4096 + (nr_keys * 3) / 4;
 19 
 20         return nr_dirty > max_dirty;
 21 }
 22 
 23 int bch2_btree_key_cache_journal_flush(struct journal *,
 24                                 struct journal_entry_pin *, u64);
 25 
 26 struct bkey_cached *
 27 bch2_btree_key_cache_find(struct bch_fs *, enum btree_id, struct bpos);
 28 
 29 int bch2_btree_path_traverse_cached(struct btree_trans *, struct btree_path *,
 30                                     unsigned);
 31 
 32 bool bch2_btree_insert_key_cached(struct btree_trans *, unsigned,
 33                         struct btree_insert_entry *);
 34 void bch2_btree_key_cache_drop(struct btree_trans *,
 35                                struct btree_path *);
 36 
 37 void bch2_fs_btree_key_cache_exit(struct btree_key_cache *);
 38 void bch2_fs_btree_key_cache_init_early(struct btree_key_cache *);
 39 int bch2_fs_btree_key_cache_init(struct btree_key_cache *);
 40 
 41 void bch2_btree_key_cache_to_text(struct printbuf *, struct btree_key_cache *);
 42 
 43 void bch2_btree_key_cache_exit(void);
 44 int __init bch2_btree_key_cache_init(void);
 45 
 46 #endif /* _BCACHEFS_BTREE_KEY_CACHE_H */
 47 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php