diff options
author | Bob Peterson <rpeterso@redhat.com> | 2018-08-07 10:07:00 -0500 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2018-08-07 10:07:00 -0500 |
commit | dffe12a82826082d2129ef91b17b257254cb60fc (patch) | |
tree | 8fea704759c5760f46a27468f6d8ec4dbbcc5c15 /fs/gfs2/incore.h | |
parent | 21e2156f3c4b2ad8b780a6d02342ca0e028a8acd (diff) | |
download | linux-dffe12a82826082d2129ef91b17b257254cb60fc.tar.gz linux-dffe12a82826082d2129ef91b17b257254cb60fc.tar.bz2 linux-dffe12a82826082d2129ef91b17b257254cb60fc.zip |
gfs2: Fix gfs2_testbit to use clone bitmaps
Function gfs2_testbit is called in three places. Two of those places,
gfs2_alloc_extent and gfs2_unaligned_extlen, should be using the clone
bitmaps, not the "real" bitmaps. Function gfs2_unaligned_extlen is used
by the block reservations scheme to determine the length of an extent of
free blocks. Before this patch, it wasn't using the clone bitmap, which
means recently-freed blocks were treated as free blocks for the purposes
of an allocation.
This patch adds a new parameter to gfs2_testbit to indicate whether or
not the clone bitmaps should be used (if available).
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/incore.h')
-rw-r--r-- | fs/gfs2/incore.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index b50908211b69..b96d39c28e17 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h @@ -65,6 +65,27 @@ struct gfs2_log_operations { #define GBF_FULL 1 +/** + * Clone bitmaps (bi_clone): + * + * - When a block is freed, we remember the previous state of the block in the + * clone bitmap, and only mark the block as free in the real bitmap. + * + * - When looking for a block to allocate, we check for a free block in the + * clone bitmap, and if no clone bitmap exists, in the real bitmap. + * + * - For allocating a block, we mark it as allocated in the real bitmap, and if + * a clone bitmap exists, also in the clone bitmap. + * + * - At the end of a log_flush, we copy the real bitmap into the clone bitmap + * to make the clone bitmap reflect the current allocation state. + * (Alternatively, we could remove the clone bitmap.) + * + * The clone bitmaps are in-core only, and is never written to disk. + * + * These steps ensure that blocks which have been freed in a transaction cannot + * be reallocated in that same transaction. + */ struct gfs2_bitmap { struct buffer_head *bi_bh; char *bi_clone; |