2017-03-17 09:18:50 +03:00
/* SPDX-License-Identifier: GPL-2.0 */
# ifndef _BCACHEFS_JOURNAL_RECLAIM_H
# define _BCACHEFS_JOURNAL_RECLAIM_H
# define JOURNAL_PIN (32 * 1024)
2019-02-21 21:33:21 +03:00
unsigned bch2_journal_dev_buckets_available ( struct journal * ,
struct journal_device * ) ;
void bch2_journal_space_available ( struct journal * ) ;
2017-03-17 09:18:50 +03:00
static inline bool journal_pin_active ( struct journal_entry_pin * pin )
{
2018-07-17 19:19:14 +03:00
return pin - > seq ! = 0 ;
2017-03-17 09:18:50 +03:00
}
static inline struct journal_entry_pin_list *
journal_seq_pin ( struct journal * j , u64 seq )
{
2018-07-17 19:19:14 +03:00
EBUG_ON ( seq < j - > pin . front | | seq > = j - > pin . back ) ;
2017-03-17 09:18:50 +03:00
return & j - > pin . data [ seq & j - > pin . mask ] ;
}
2019-02-21 21:33:21 +03:00
void bch2_journal_pin_put ( struct journal * , u64 ) ;
2017-03-17 09:18:50 +03:00
void bch2_journal_pin_add ( struct journal * , u64 , struct journal_entry_pin * ,
journal_pin_flush_fn ) ;
2018-07-17 20:50:15 +03:00
void bch2_journal_pin_update ( struct journal * , u64 , struct journal_entry_pin * ,
journal_pin_flush_fn ) ;
2017-03-17 09:18:50 +03:00
void bch2_journal_pin_drop ( struct journal * , struct journal_entry_pin * ) ;
void bch2_journal_pin_add_if_older ( struct journal * ,
struct journal_entry_pin * ,
struct journal_entry_pin * ,
journal_pin_flush_fn ) ;
2018-07-17 19:19:14 +03:00
void bch2_journal_pin_flush ( struct journal * , struct journal_entry_pin * ) ;
2017-03-17 09:18:50 +03:00
2019-03-04 02:39:07 +03:00
void bch2_journal_do_discards ( struct journal * ) ;
2017-03-17 09:18:50 +03:00
void bch2_journal_reclaim_work ( struct work_struct * ) ;
void bch2_journal_flush_pins ( struct journal * , u64 ) ;
static inline void bch2_journal_flush_all_pins ( struct journal * j )
{
bch2_journal_flush_pins ( j , U64_MAX ) ;
}
int bch2_journal_flush_device_pins ( struct journal * , int ) ;
# endif /* _BCACHEFS_JOURNAL_RECLAIM_H */