Skip to contentSkip to conversation

struct super_block cleanup - affs

PATCH New Brian Gerst 1 participant 1 message Mar 18, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 struct super_block cleanup - affs

Seperates affs_sb_info from struct super_block.

Signature · 1 line
						Brian Gerst
fs/affs/amigaffs.c +2 -2
diff -urN linux-2.5.7-pre2/fs/affs/amigaffs.c linux/fs/affs/amigaffs.c
@@ -246,7 +246,7 @@
 		goto done;
 
 	retval = -ENOTEMPTY;
-	for (size = AFFS_SB->s_hashsize - 1; size >= 0; size--)
+	for (size = AFFS_SB(sb)->s_hashsize - 1; size >= 0; size--)
 		if (AFFS_HEAD(bh)->table[size])
 			goto not_empty;
 	retval = 0;
@@ -458,7 +458,7 @@
 	if (!(sb->s_flags & MS_RDONLY))
 		printk(KERN_WARNING "AFFS: Remounting filesystem read-only\n");
 	sb->s_flags |= MS_RDONLY;
-	AFFS_SB->s_flags |= SF_READONLY;	/* Don't allow to remount rw */
+	AFFS_SB(sb)->s_flags |= SF_READONLY;	/* Don't allow to remount rw */
 }
 
 void
fs/affs/bitmap.c +56 -52

251 lines not on this page · raw message

fs/affs/dir.c +1 -1
diff -urN linux-2.5.7-pre2/fs/affs/dir.c linux/fs/affs/dir.c
@@ -122,7 +122,7 @@
 		goto inside;
 	hash_pos++;
 
-	for (; hash_pos < AFFS_SB->s_hashsize; hash_pos++) {
+	for (; hash_pos < AFFS_SB(sb)->s_hashsize; hash_pos++) {
 		ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]);
 		if (!ino)
 			continue;
fs/affs/file.c +11 -11
diff -urN linux-2.5.7-pre2/fs/affs/file.c linux/fs/affs/file.c
@@ -350,8 +350,8 @@
 	//lock cache
 	affs_lock_ext(inode);
 
-	ext = block / AFFS_SB->s_hashsize;
-	block -= ext * AFFS_SB->s_hashsize;
+	ext = block / AFFS_SB(sb)->s_hashsize;
+	block -= ext * AFFS_SB(sb)->s_hashsize;
 	ext_bh = affs_get_extblock(inode, ext);
 	if (IS_ERR(ext_bh))
 		goto err_ext;
@@ -362,7 +362,7 @@
 		if (!blocknr)
 			goto err_alloc;
 		bh_result->b_state |= (1UL << BH_New);
-		AFFS_I(inode)->mmu_private += AFFS_SB->s_data_blksize;
+		AFFS_I(inode)->mmu_private += AFFS_SB(sb)->s_data_blksize;
 		AFFS_I(inode)->i_blkcnt++;
 
 		/* store new block */
@@ -516,7 +516,7 @@
 
 	pr_debug("AFFS: read_page(%u, %ld, %d, %d)\n", (u32)inode->i_ino, page->index, from, to);
 	data = page_address(page);
-	bsize = AFFS_SB->s_data_blksize;
+	bsize = AFFS_SB(sb)->s_data_blksize;
 	tmp = (page->index << PAGE_CACHE_SHIFT) + from;
 	bidx = tmp / bsize;
 	boff = tmp % bsize;
@@ -546,7 +546,7 @@
 	u32 tmp;
 
 	pr_debug("AFFS: extent_file(%u, %d)\n", (u32)inode->i_ino, newsize);
-	bsize = AFFS_SB->s_data_blksize;
+	bsize = AFFS_SB(sb)->s_data_blksize;
 	bh = NULL;
 	size = inode->i_size;
 	bidx = size / bsize;
@@ -670,7 +670,7 @@
 	int written;
 
 	pr_debug("AFFS: commit_write(%u, %ld, %d, %d)\n", (u32)inode->i_ino, page->index, from, to);
-	bsize = AFFS_SB->s_data_blksize;
+	bsize = AFFS_SB(sb)->s_data_blksize;
 	data = page_address(page);
 
 	bh = NULL;
@@ -811,8 +811,8 @@
 	last_blk = 0;
 	ext = 0;
 	if (inode->i_size) {
-		last_blk = ((u32)inode->i_size - 1) / AFFS_SB->s_data_blksize;
-		ext = last_blk / AFFS_SB->s_hashsize;
+		last_blk = ((u32)inode->i_size - 1) / AFFS_SB(sb)->s_data_blksize;
+		ext = last_blk / AFFS_SB(sb)->s_hashsize;
 	}
 
 	if (inode->i_size > AFFS_I(inode)->mmu_private) {
@@ -857,11 +857,11 @@
 	i = 0;
 	blk = last_blk;
 	if (inode->i_size) {
-		i = last_blk % AFFS_SB->s_hashsize + 1;
+		i = last_blk % AFFS_SB(sb)->s_hashsize + 1;
 		blk++;
 	} else
 		AFFS_HEAD(ext_bh)->first_data = 0;
-	size = AFFS_SB->s_hashsize;
+	size = AFFS_SB(sb)->s_hashsize;
 	if (size > blkcnt - blk + i)
 		size = blkcnt - blk + i;
 	for (; i < size; i++, blk++) {
@@ -885,7 +885,7 @@
 
 	while (ext_key) {
 		ext_bh = affs_bread(sb, ext_key);
-		size = AFFS_SB->s_hashsize;
+		size = AFFS_SB(sb)->s_hashsize;
 		if (size > blkcnt - blk)
 			size = blkcnt - blk;
 		for (i = 0; i < size; i++, blk++)
fs/affs/inode.c +23 -22

106 lines not on this page · raw message

fs/affs/namei.c +7 -7
diff -urN linux-2.5.7-pre2/fs/affs/namei.c linux/fs/affs/namei.c
@@ -64,7 +64,7 @@
 static inline toupper_t
 affs_get_toupper(struct super_block *sb)
 {
-	return AFFS_SB->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper;
+	return AFFS_SB(sb)->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper;
 }
 
 /*
@@ -177,7 +177,7 @@
 	for (; len > 0; len--)
 		hash = (hash * 13 + toupper(*name++)) & 0x7ff;
 
-	return hash % AFFS_SB->s_hashsize;
+	return hash % AFFS_SB(sb)->s_hashsize;
 }
 
 static struct buffer_head *
@@ -244,7 +244,7 @@
 			return ERR_PTR(-EACCES);
 		}
 	}
-	dentry->d_op = AFFS_SB->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations;
+	dentry->d_op = AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations;
 	unlock_kernel();
 	d_add(dentry, inode);
 	return NULL;
@@ -289,7 +289,7 @@
 
 	inode->i_op = &affs_file_inode_operations;
 	inode->i_fop = &affs_file_operations;
-	inode->i_mapping->a_ops = (AFFS_SB->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
+	inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
 	error = affs_add_entry(dir, inode, dentry, ST_FILE);
 	if (error) {
 		inode->i_nlink = 0;
@@ -367,7 +367,7 @@
 		 (int)dentry->d_name.len,dentry->d_name.name,symname);
 
 	lock_kernel();
-	maxlen = AFFS_SB->s_hashsize * sizeof(u32) - 1;
+	maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1;
 	error = -ENOSPC;
 	inode  = affs_new_inode(dir);
 	if (!inode) {
@@ -390,8 +390,8 @@
 	if (*symname == '/') {
 		while (*symname == '/')
 			symname++;
-		while (AFFS_SB->s_volume[i])	/* Cannot overflow */
-			*p++ = AFFS_SB->s_volume[i++];
+		while (AFFS_SB(sb)->s_volume[i])	/* Cannot overflow */
+			*p++ = AFFS_SB(sb)->s_volume[i++];
 	}
 	while (i < maxlen && (c = *symname++)) {
 		if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') {
fs/affs/super.c +72 -58

274 lines not on this page · raw message

fs/affs/symlink.c +1 -1
diff -urN linux-2.5.7-pre2/fs/affs/symlink.c linux/fs/affs/symlink.c
@@ -40,7 +40,7 @@
 	j  = 0;
 	lf = (struct slink_front *)bh->b_data;
 	lc = 0;
-	pf = inode->i_sb->u.affs_sb.s_prefix ? inode->i_sb->u.affs_sb.s_prefix : "/";
+	pf = AFFS_SB(inode->i_sb)->s_prefix ? AFFS_SB(inode->i_sb)->s_prefix : "/";
 
 	if (strchr(lf->symname,':')) {	/* Handle assign or volume name */
 		while (i < 1023 && (c = pf[i]))
include/linux/affs_fs.h +1 -0
diff -urN linux-2.5.7-pre2/include/linux/affs_fs.h linux/include/linux/affs_fs.h
@@ -7,6 +7,7 @@
 #include <linux/types.h>
 
 #include <linux/affs_fs_i.h>
+#include <linux/affs_fs_sb.h>
 
 #define AFFS_SUPER_MAGIC 0xadff
 
include/linux/affs_fs_sb.h +4 -1
diff -urN linux-2.5.7-pre2/include/linux/affs_fs_sb.h linux/include/linux/affs_fs_sb.h
@@ -50,6 +50,9 @@
 #define SF_READONLY	0x1000		/* Don't allow to remount rw */
 
 /* short cut to get to the affs specific sb data */
-#define AFFS_SB		(&sb->u.affs_sb)
+static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
+{
+	return sb->u.generic_sbp;
+}
 
 #endif
include/linux/amigaffs.h +5 -5
diff -urN linux-2.5.7-pre2/include/linux/amigaffs.h linux/include/linux/amigaffs.h
@@ -18,7 +18,7 @@
 
 #define GET_END_PTR(st,p,sz)		 ((st *)((char *)(p)+((sz)-sizeof(st))))
 #define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey])
-#define AFFS_BLOCK(sb, bh, blk)		(AFFS_HEAD(bh)->table[(sb)->u.affs_sb.s_hashsize-1-(blk)])
+#define AFFS_BLOCK(sb, bh, blk)		(AFFS_HEAD(bh)->table[AFFS_SB(sb)->s_hashsize-1-(blk)])
 
 static inline void
 affs_set_blocksize(struct super_block *sb, int size)
@@ -29,7 +29,7 @@
 affs_bread(struct super_block *sb, int block)
 {
 	pr_debug(KERN_DEBUG "affs_bread: %d\n", block);
-	if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size)
+	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size)
 		return sb_bread(sb, block);
 	return NULL;
 }
@@ -37,7 +37,7 @@
 affs_getblk(struct super_block *sb, int block)
 {
 	pr_debug(KERN_DEBUG "affs_getblk: %d\n", block);
-	if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size)
+	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size)
 		return sb_getblk(sb, block);
 	return NULL;
 }
@@ -46,7 +46,7 @@
 {
 	struct buffer_head *bh;
 	pr_debug(KERN_DEBUG "affs_getzeroblk: %d\n", block);
-	if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size) {
+	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) {
 		bh = sb_getblk(sb, block);
 		lock_buffer(bh);
 		memset(bh->b_data, 0 , sb->s_blocksize);
@@ -61,7 +61,7 @@
 {
 	struct buffer_head *bh;
 	pr_debug(KERN_DEBUG "affs_getemptyblk: %d\n", block);
-	if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size) {
+	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) {
 		bh = sb_getblk(sb, block);
 		wait_on_buffer(bh);
 		mark_buffer_uptodate(bh, 1);
include/linux/fs.h +0 -2
diff -urN linux-2.5.7-pre2/include/linux/fs.h linux/include/linux/fs.h
@@ -650,7 +650,6 @@
 #include <linux/ntfs_fs_sb.h>
 #include <linux/iso_fs_sb.h>
 #include <linux/sysv_fs_sb.h>
-#include <linux/affs_fs_sb.h>
 #include <linux/ufs_fs_sb.h>
 #include <linux/romfs_fs_sb.h>
 #include <linux/hfs_fs_sb.h>
@@ -699,7 +698,6 @@
 		struct ntfs_sb_info	ntfs_sb;
 		struct isofs_sb_info	isofs_sb;
 		struct sysv_sb_info	sysv_sb;
-		struct affs_sb_info	affs_sb;
 		struct ufs_sb_info	ufs_sb;
 		struct shmem_sb_info	shmem_sb;
 		struct romfs_sb_info	romfs_sb;