[Cluster-devel] [GFS2 PATCH] [v2] GFS2: Introduce new gfs2_log_header_v2

Andrew Price anprice at redhat.com
Mon Dec 11 16:18:42 UTC 2017


On 08/12/17 15:28, Bob Peterson wrote:
> Here is a version 2 replacement for this patch, with improvements.
> ---
> This patch adds a new structure called gfs2_log_header_v2 which is
> used to store expanded fields into previously unused areas of the
> log headers. Some of these are used for debug purposes so we can
> backtrack when problems occur. Others are reserved for future
> expansion.
> 
> This is based on a prototype patch from Steve Whitehouse.
> 
> Signed-off-by: Bob Peterson <rpeterso at redhat.com>
> ---
>   fs/gfs2/log.c                    | 26 +++++++++++++++++++++---
>   fs/gfs2/lops.c                   | 43 +++++++++++++++++++++++++++++++++++++---
>   fs/gfs2/lops.h                   |  1 +
>   include/uapi/linux/gfs2_ondisk.h | 18 +++++++++++++++++
>   4 files changed, 82 insertions(+), 6 deletions(-)

recovery.c has:

gfs2_log_header_in()
get_log_header()
clean_journal()

which deal with log headers - do they need to be updated?

<snip>
> --- a/fs/gfs2/lops.c
> +++ b/fs/gfs2/lops.c
> @@ -18,6 +18,7 @@
>   #include <linux/fs.h>
>   #include <linux/list_sort.h>
>   
> +#include "dir.h"
>   #include "gfs2.h"
>   #include "incore.h"
>   #include "inode.h"
> @@ -306,6 +307,25 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno)
>   	return gfs2_log_alloc_bio(sdp, blkno);
>   }
>   
> +/**
> + * gfs2_set_log_csum - Set a whole-block checksum for a page
> + * @sb: The superblock
> + * @page: The page to write
> + * @blkno: The device block number we want to write to
> + *
> + * Set the location of the block to be written and then checksum the block
> + * before writing it.
> + */
> +static void gfs2_set_log_csum(struct super_block *sb, struct page *page,
> +			      u64 blkno)
> +{
> +	struct gfs2_log_header_v2 *lh = page_address(page);
> +	u32 hash;
> +
> +	lh->lh_addr = cpu_to_be64(blkno);

Does lh->lh_crc need to be zeroed at this point?

> +	hash = gfs2_disk_hash(page_address(page), sb->s_blocksize);
> +	lh->lh_crc = cpu_to_be32(hash);
> +}

Cheers,
Andy




More information about the Cluster-devel mailing list