Files
scoutfs/kmod/src/block.h
Zach Brown 6fd5396fbe Add block cache shrinker
Now that we have our own allocated block cache struct we need to add a
shrinker so that it's reclaimed under memory pressure.  We keep clean
blocks in a simple lru list that the shrinker walks to free the oldest
blocks.

Signed-off-by: Zach Brown <zab@versity.com>
Reviewed-by: Mark Fasheh <mfasheh@versity.com>
2016-11-16 14:45:07 -08:00

39 lines
1.5 KiB
C

#ifndef _SCOUTFS_BLOCK_H_
#define _SCOUTFS_BLOCK_H_
struct scoutfs_block;
#include <linux/fs.h>
struct scoutfs_block *scoutfs_block_read(struct super_block *sb, u64 blkno);
struct scoutfs_block *scoutfs_block_read_ref(struct super_block *sb,
struct scoutfs_block_ref *ref);
struct scoutfs_block *scoutfs_block_dirty(struct super_block *sb, u64 blkno);
struct scoutfs_block *scoutfs_block_dirty_alloc(struct super_block *sb);
struct scoutfs_block *scoutfs_block_dirty_ref(struct super_block *sb,
struct scoutfs_block_ref *ref);
int scoutfs_block_has_dirty(struct super_block *sb);
int scoutfs_block_write_dirty(struct super_block *sb);
int scoutfs_block_write_sync(struct scoutfs_block *bl);
void scoutfs_block_set_crc(struct scoutfs_block *bl);
void scoutfs_block_zero(struct scoutfs_block *bl, size_t off);
void scoutfs_block_zero_from(struct scoutfs_block *bl, void *ptr);
void scoutfs_block_set_lock_class(struct scoutfs_block *bl,
struct lock_class_key *class);
void scoutfs_block_lock(struct scoutfs_block *bl, bool write, int subclass);
void scoutfs_block_unlock(struct scoutfs_block *bl, bool write);
void *scoutfs_block_data(struct scoutfs_block *bl);
void *scoutfs_block_data_from_contents(const void *ptr);
void scoutfs_block_forget(struct scoutfs_block *bl);
void scoutfs_block_put(struct scoutfs_block *bl);
int scoutfs_block_shrink(struct shrinker *shrink, struct shrink_control *sc);
void scoutfs_block_destroy(struct super_block *sb);
#endif