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


Groups > linux.kernel > #1420137 > unrolled thread

[PATCH 1/3] befs: check return of sb_min_blocksize

Started byLuis de Bethencourt <luisbg@osg.samsung.com>
First post2016-06-12 05:00 +0200
Last post2016-06-12 05:00 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] befs: check return of sb_min_blocksize Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-12 05:00 +0200
    [PATCH 2/3] befs: fix function name in documentation Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-12 05:00 +0200
    [PATCH 3/3] befs: remove unused functions Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-12 05:00 +0200

#1420137 — [PATCH 1/3] befs: check return of sb_min_blocksize

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-06-12 05:00 +0200
Subject[PATCH 1/3] befs: check return of sb_min_blocksize
Message-ID<rJ3MZ-2Xu-15@gated-at.bofh.it>
Confirm sb_min_blocksize() succeeded before continuing.

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

This is the main fix I wanted to send. I noticed other file systems check
the return of sb_min_blocksize(), it can fail so it is worth checking before
continuing.

Thanks :)
Luis

 fs/befs/linuxvfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c734f21..453bb68 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -756,6 +756,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	long ret = -EINVAL;
 	const unsigned long sb_block = 0;
 	const off_t x86_sb_off = 512;
+	int blocksize;
 
 	save_mount_options(sb, data);
 
@@ -788,7 +789,11 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	 * least 1k to get the second 512 bytes of the volume.
 	 * -WD 10-26-01
 	 */ 
-	sb_min_blocksize(sb, 1024);
+	blocksize = sb_min_blocksize(sb, 1024);
+	if (!blocksize) {
+		befs_error(sb, "unable to set blocksize");
+		goto unacquire_priv_sbp;
+	}
 
 	if (!(bh = sb_bread(sb, sb_block))) {
 		if (!silent)
-- 
2.5.1

[toc] | [next] | [standalone]


#1420142 — [PATCH 2/3] befs: fix function name in documentation

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-06-12 05:00 +0200
Subject[PATCH 2/3] befs: fix function name in documentation
Message-ID<rJ3MZ-2Xu-19@gated-at.bofh.it>
In reply to#1420137
Documentation of function befs_load_cb lists it as load_befs_sb. Fixing the
misnomer.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
 fs/befs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/befs/super.c b/fs/befs/super.c
index aeafc4d..9d1b56c 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -14,7 +14,7 @@
 #include "super.h"
 
 /**
- * load_befs_sb -- Read from disk and properly byteswap all the fields
+ * befs_load_sb -- Read from disk and properly byteswap all the fields
  * of the befs superblock
  *
  *
-- 
2.5.1

[toc] | [prev] | [next] | [standalone]


#1420143 — [PATCH 3/3] befs: remove unused functions

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-06-12 05:00 +0200
Subject[PATCH 3/3] befs: remove unused functions
Message-ID<rJ3N0-2Xu-31@gated-at.bofh.it>
In reply to#1420137
befs_iaddr_is_empty() and befs_brun_size() are unused. Removing them.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
 fs/befs/befs.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index e0f59263a..c5c6cd1 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -140,18 +140,6 @@ befs_iaddrs_per_block(struct super_block *sb)
 	return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);
 }
 
-static inline int
-befs_iaddr_is_empty(const befs_inode_addr *iaddr)
-{
-	return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len);
-}
-
-static inline size_t
-befs_brun_size(struct super_block *sb, befs_block_run run)
-{
-	return BEFS_SB(sb)->block_size * run.len;
-}
-
 #include "endian.h"
 
 #endif				/* _LINUX_BEFS_H */
-- 
2.5.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web