mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-06 12:06:26 +00:00
scoutfs: add scoutfs_block_forget()
The upcoming allocator changes have a need to forget dirty blocks so they're not written. It proabably won't be the only one. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -469,6 +469,29 @@ struct buffer_head *scoutfs_block_dirty_alloc(struct super_block *sb)
|
||||
return bh;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure that we don't have a dirty block at the given blkno. If we
|
||||
* do we remove it from our tree of dirty blocks and clear the buffer
|
||||
* dirty bit.
|
||||
*
|
||||
* XXX for now callers have only needed to forget blknos, maybe they'll
|
||||
* have the bh some day.
|
||||
*/
|
||||
void scoutfs_block_forget(struct super_block *sb, u64 blkno)
|
||||
{
|
||||
struct block_bh_private *bhp;
|
||||
struct buffer_head *bh;
|
||||
|
||||
bh = sb_find_get_block(sb, blkno);
|
||||
if (bh) {
|
||||
bhp = bh->b_private;
|
||||
if (bhp) {
|
||||
erase_bhp(bh);
|
||||
bforget(bh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void scoutfs_block_set_crc(struct buffer_head *bh)
|
||||
{
|
||||
struct scoutfs_block_header *hdr = bh_data(bh);
|
||||
|
||||
@@ -25,6 +25,8 @@ void scoutfs_block_set_lock_class(struct buffer_head *bh,
|
||||
void scoutfs_block_lock(struct buffer_head *bh, bool write, int subclass);
|
||||
void scoutfs_block_unlock(struct buffer_head *bh, bool write);
|
||||
|
||||
void scoutfs_block_forget(struct super_block *sb, u64 blkno);
|
||||
|
||||
/* XXX seems like this should be upstream :) */
|
||||
static inline void *bh_data(struct buffer_head *bh)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user