Skip to contentSkip to conversation

struct super_block cleanup - bfs

PATCH New Brian Gerst 1 participant 1 message Mar 17, 2002 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 struct super_block cleanup - bfs

Seperates bfs_sb_info from struct super_block.

Signature · 1 line
						Brian Gerst
fs/bfs/bfs_defs.h +0 -11
diff -urN linux-2.5.7-pre2/fs/bfs/bfs_defs.h linux/fs/bfs/bfs_defs.h
@@ -1,14 +1,3 @@
-#define su_lasti	u.bfs_sb.si_lasti
-#define su_blocks	u.bfs_sb.si_blocks
-#define su_freeb	u.bfs_sb.si_freeb
-#define su_freei	u.bfs_sb.si_freei
-#define su_lf_ioff	u.bfs_sb.si_lf_ioff
-#define su_lf_sblk	u.bfs_sb.si_lf_sblk
-#define su_lf_eblk	u.bfs_sb.si_lf_eblk
-#define su_imap		u.bfs_sb.si_imap
-#define su_sbh		u.bfs_sb.si_sbh
-#define su_bfs_sb	u.bfs_sb.si_bfs_sb
-
 #define printf(format, args...) \
 	printk(KERN_ERR "BFS-fs: %s(): " format, __FUNCTION__, ## args)
 
fs/bfs/dir.c +5 -6
diff -urN linux-2.5.7-pre2/fs/bfs/dir.c linux/fs/bfs/dir.c
@@ -78,20 +78,21 @@
 	int err;
 	struct inode * inode;
 	struct super_block * s = dir->i_sb;
+	struct bfs_sb_info * info = BFS_SB(s);
 	unsigned long ino;
 
 	inode = new_inode(s);
 	if (!inode)
 		return -ENOSPC;
 	lock_kernel();
-	ino = find_first_zero_bit(s->su_imap, s->su_lasti);
-	if (ino > s->su_lasti) {
+	ino = find_first_zero_bit(info->si_imap, info->si_lasti);
+	if (ino > info->si_lasti) {
 		unlock_kernel();
 		iput(inode);
 		return -ENOSPC;
 	}
-	set_bit(ino, s->su_imap);	
-	s->su_freei--;
+	set_bit(ino, info->si_imap);	
+	info->si_freei--;
 	inode->i_uid = current->fsuid;
 	inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
@@ -318,11 +319,9 @@
 {
 	unsigned long block, offset;
 	struct buffer_head * bh;
-	struct bfs_sb_info * info;
 	struct bfs_dirent * de;
 
 	*res_dir = NULL;
-	info = &dir->i_sb->u.bfs_sb;
 	if (namelen > BFS_NAMELEN)
 		return NULL;
 	bh = NULL;
fs/bfs/file.c +9 -8
diff -urN linux-2.5.7-pre2/fs/bfs/file.c linux/fs/bfs/file.c
@@ -60,10 +60,11 @@
 	long phys;
 	int err;
 	struct super_block *sb = inode->i_sb;
+	struct bfs_sb_info *info = BFS_SB(sb);
 	struct bfs_inode_info *bi = BFS_I(inode);
-	struct buffer_head *sbh = sb->su_sbh;
+	struct buffer_head *sbh = info->si_sbh;
 
-	if (block < 0 || block > sb->su_blocks)
+	if (block < 0 || block > info->si_blocks)
 		return -EIO;
 
 	phys = bi->i_sblock + block;
@@ -89,12 +90,12 @@
 
 	/* if the last data block for this file is the last allocated block, we can
 	   extend the file trivially, without moving it anywhere */
-	if (bi->i_eblock == sb->su_lf_eblk) {
+	if (bi->i_eblock == info->si_lf_eblk) {
 		dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", 
 				create, block, phys);
 		map_bh(bh_result, sb, phys);
-		sb->su_freeb -= phys - bi->i_eblock;
-		sb->su_lf_eblk = bi->i_eblock = phys;
+		info->si_freeb -= phys - bi->i_eblock;
+		info->si_lf_eblk = bi->i_eblock = phys;
 		mark_inode_dirty(inode);
 		mark_buffer_dirty(sbh);
 		err = 0;
@@ -102,7 +103,7 @@
 	}
 
 	/* Ok, we have to move this entire file to the next free block */
-	phys = sb->su_lf_eblk + 1;
+	phys = info->si_lf_eblk + 1;
 	if (bi->i_sblock) { /* if data starts on block 0 then there is no data */
 		err = bfs_move_blocks(inode->i_sb, bi->i_sblock, 
 				bi->i_eblock, phys);
@@ -116,11 +117,11 @@
 	dprintf("c=%d, b=%08lx, phys=%08lx (moved)\n", create, block, phys);
 	bi->i_sblock = phys;
 	phys += block;
-	sb->su_lf_eblk = bi->i_eblock = phys;
+	info->si_lf_eblk = bi->i_eblock = phys;
 
 	/* this assumes nothing can write the inode back while we are here
 	 * and thus update inode->i_blocks! (XXX)*/
-	sb->su_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks;
+	info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks;
 	mark_inode_dirty(inode);
 	mark_buffer_dirty(sbh);
 	map_bh(bh_result, sb, phys);
fs/bfs/inode.c +57 -43

199 lines not on this page · raw message

include/linux/bfs_fs.h +6 -0
diff -urN linux-2.5.7-pre2/include/linux/bfs_fs.h linux/include/linux/bfs_fs.h
@@ -7,6 +7,7 @@
 #define _LINUX_BFS_FS_H
 
 #include <linux/bfs_fs_i.h>
+#include <linux/bfs_fs_sb.h>
 
 #define BFS_BSIZE_BITS		9
 #define BFS_BSIZE		(1<<BFS_BSIZE_BITS)
@@ -89,6 +90,11 @@
 extern struct inode_operations bfs_dir_inops;
 extern struct file_operations bfs_dir_operations;
 
+static inline struct bfs_sb_info *BFS_SB(struct super_block *sb)
+{
+	return sb->u.generic_sbp;
+}
+
 static inline struct bfs_inode_info *BFS_I(struct inode *inode)
 {
 	return list_entry(inode, struct bfs_inode_info, vfs_inode);
include/linux/fs.h +0 -2
diff -urN linux-2.5.7-pre2/include/linux/fs.h linux/include/linux/fs.h
@@ -656,7 +656,6 @@
 #include <linux/hfs_fs_sb.h>
 #include <linux/adfs_fs_sb.h>
 #include <linux/reiserfs_fs_sb.h>
-#include <linux/bfs_fs_sb.h>
 #include <linux/udf_fs_sb.h>
 #include <linux/jffs2_fs_sb.h>
 
@@ -706,7 +705,6 @@
 		struct hfs_sb_info	hfs_sb;
 		struct adfs_sb_info	adfs_sb;
 		struct reiserfs_sb_info	reiserfs_sb;
-		struct bfs_sb_info	bfs_sb;
 		struct udf_sb_info	udf_sb;
 		struct jffs2_sb_info	jffs2_sb;
 		void			*generic_sbp;