lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Jan 2019 21:14:08 +0800
From:   yangerkun <yangerkun@...wei.com>
To:     <jack@...e.cz>
CC:     <miaoxie@...wei.com>, <yi.zhang@...wei.com>, <houtao1@...wei.com>,
        <yangerkun@...wei.com>, <linux-ext4@...r.kernel.org>
Subject: [PATCH 1/2] ext2: remove static of ext2_block_to_path

This function will be used to get exact size in ext2_max_size future.

Signed-off-by: yangerkun <yangerkun@...wei.com>
---
 fs/ext2/ext2.h  |  1 +
 fs/ext2/inode.c | 16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index e770cd1..86d5be1 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -772,6 +772,7 @@ extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
 extern struct inode *ext2_iget (struct super_block *, unsigned long);
 extern int ext2_write_inode (struct inode *, struct writeback_control *);
 extern void ext2_evict_inode(struct inode *);
+extern int ext2_block_to_path(struct super_block *sb, long i_block, int offsets[4], int *boundary);
 extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
 extern int ext2_setattr (struct dentry *, struct iattr *);
 extern void ext2_set_inode_flags(struct inode *inode);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index e4bb938..f2833245 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -132,7 +132,6 @@ static inline int verify_chain(Indirect *from, Indirect *to)
 
 /**
  *	ext2_block_to_path - parse the block number into array of offsets
- *	@inode: inode in question (we are only interested in its superblock)
  *	@i_block: block number to be parsed
  *	@offsets: array to store the offsets in
  *      @boundary: set this non-zero if the referred-to block is likely to be
@@ -160,11 +159,11 @@ static inline int verify_chain(Indirect *from, Indirect *to)
  * get there at all.
  */
 
-static int ext2_block_to_path(struct inode *inode,
+int ext2_block_to_path(struct super_block *sb,
 			long i_block, int offsets[4], int *boundary)
 {
-	int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
-	int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
+	int ptrs = EXT2_ADDR_PER_BLOCK(sb);
+	int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(sb);
 	const long direct_blocks = EXT2_NDIR_BLOCKS,
 		indirect_blocks = ptrs,
 		double_blocks = (1 << (ptrs_bits * 2));
@@ -172,7 +171,7 @@ static int ext2_block_to_path(struct inode *inode,
 	int final = 0;
 
 	if (i_block < 0) {
-		ext2_msg(inode->i_sb, KERN_WARNING,
+		ext2_msg(sb, KERN_WARNING,
 			"warning: %s: block < 0", __func__);
 	} else if (i_block < direct_blocks) {
 		offsets[n++] = i_block;
@@ -193,7 +192,7 @@ static int ext2_block_to_path(struct inode *inode,
 		offsets[n++] = i_block & (ptrs - 1);
 		final = ptrs;
 	} else {
-		ext2_msg(inode->i_sb, KERN_WARNING,
+		ext2_msg(sb, KERN_WARNING,
 			"warning: %s: block is too big", __func__);
 	}
 	if (boundary)
@@ -637,7 +636,8 @@ static int ext2_get_blocks(struct inode *inode,
 
 	BUG_ON(maxblocks == 0);
 
-	depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary);
+	depth = ext2_block_to_path(inode->i_sb, iblock,
+				offsets, &blocks_to_boundary);
 
 	if (depth == 0)
 		return -EIO;
@@ -1194,7 +1194,7 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
 	WARN_ON(!rwsem_is_locked(&ei->dax_sem));
 #endif
 
-	n = ext2_block_to_path(inode, iblock, offsets, NULL);
+	n = ext2_block_to_path(inode->i_sb, iblock, offsets, NULL);
 	if (n == 0)
 		return;
 
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ