Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1458759 > unrolled thread

[PATCH 1/2] befs: add flags field to validate superblock state

Started bySalah Triki <salah.triki@gmail.com>
First post2016-08-09 15:50 +0200
Last post2016-08-09 17:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] befs: add flags field to validate superblock state Salah Triki <salah.triki@gmail.com> - 2016-08-09 15:50 +0200
    Re: [PATCH 1/2] befs: add flags field to validate superblock state Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-08-09 17:40 +0200

#1458759 — [PATCH 1/2] befs: add flags field to validate superblock state

FromSalah Triki <salah.triki@gmail.com>
Date2016-08-09 15:50 +0200
Subject[PATCH 1/2] befs: add flags field to validate superblock state
Message-ID<s4fzP-8eY-15@gated-at.bofh.it>
For validating superblock state, add flags field to befs_sb_info, read the state from the disk
and check if it is equal to BEFS_DIRTY.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 fs/befs/befs.h  | 3 +++
 fs/befs/super.c | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index e0f59263a..511d16d 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -43,6 +43,9 @@ struct befs_sb_info {
 	u32 ag_shift;
 	u32 num_ags;
 
+	/* State of the superblock */
+	u32 flags;
+
 	/* jornal log entry */
 	befs_block_run log_blocks;
 	befs_off_t log_start;
diff --git a/fs/befs/super.c b/fs/befs/super.c
index aeafc4d..79be409 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -45,6 +45,8 @@ befs_load_sb(struct super_block *sb, befs_super_block * disk_sb)
 	befs_sb->ag_shift = fs32_to_cpu(sb, disk_sb->ag_shift);
 	befs_sb->num_ags = fs32_to_cpu(sb, disk_sb->num_ags);
 
+	befs_sb->flags = fs32_to_cpu(sb, disk_sb->flags);
+
 	befs_sb->log_blocks = fsrun_to_cpu(sb, disk_sb->log_blocks);
 	befs_sb->log_start = fs64_to_cpu(sb, disk_sb->log_start);
 	befs_sb->log_end = fs64_to_cpu(sb, disk_sb->log_end);
@@ -101,7 +103,7 @@ befs_check_sb(struct super_block *sb)
 		return BEFS_ERR;
 	}
 
-	if (befs_sb->log_start != befs_sb->log_end) {
+	if (befs_sb->log_start != befs_sb->log_end || befs_sb->flags == BEFS_DIRTY) {
 		befs_error(sb, "Filesystem not clean! There are blocks in the "
 			   "journal. You must boot into BeOS and mount this volume "
 			   "to make it clean.");
-- 
1.9.1

[toc] | [next] | [standalone]


#1458856

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-08-09 17:40 +0200
Message-ID<s4hih-YE-5@gated-at.bofh.it>
In reply to#1458759
On 09/08/16 14:46, Salah Triki wrote:
> For validating superblock state, add flags field to befs_sb_info, read the state from the disk
> and check if it is equal to BEFS_DIRTY.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  fs/befs/befs.h  | 3 +++
>  fs/befs/super.c | 4 +++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/befs/befs.h b/fs/befs/befs.h
> index e0f59263a..511d16d 100644
> --- a/fs/befs/befs.h
> +++ b/fs/befs/befs.h
> @@ -43,6 +43,9 @@ struct befs_sb_info {
>  	u32 ag_shift;
>  	u32 num_ags;
>  
> +	/* State of the superblock */
> +	u32 flags;
> +
>  	/* jornal log entry */
>  	befs_block_run log_blocks;
>  	befs_off_t log_start;
> diff --git a/fs/befs/super.c b/fs/befs/super.c
> index aeafc4d..79be409 100644
> --- a/fs/befs/super.c
> +++ b/fs/befs/super.c
> @@ -45,6 +45,8 @@ befs_load_sb(struct super_block *sb, befs_super_block * disk_sb)
>  	befs_sb->ag_shift = fs32_to_cpu(sb, disk_sb->ag_shift);
>  	befs_sb->num_ags = fs32_to_cpu(sb, disk_sb->num_ags);
>  
> +	befs_sb->flags = fs32_to_cpu(sb, disk_sb->flags);
> +
>  	befs_sb->log_blocks = fsrun_to_cpu(sb, disk_sb->log_blocks);
>  	befs_sb->log_start = fs64_to_cpu(sb, disk_sb->log_start);
>  	befs_sb->log_end = fs64_to_cpu(sb, disk_sb->log_end);
> @@ -101,7 +103,7 @@ befs_check_sb(struct super_block *sb)
>  		return BEFS_ERR;
>  	}
>  
> -	if (befs_sb->log_start != befs_sb->log_end) {
> +	if (befs_sb->log_start != befs_sb->log_end || befs_sb->flags == BEFS_DIRTY) {
>  		befs_error(sb, "Filesystem not clean! There are blocks in the "
>  			   "journal. You must boot into BeOS and mount this volume "
>  			   "to make it clean.");
> 

Good catch.

Funny how the flags element had been added to the befs_super_block, but not to
befs_sb_info.

Thanks :)
Luis

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web