summaryrefslogtreecommitdiff
path: root/fs/ufs/super.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2007-02-12 00:54:31 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 09:48:40 -0800
commit3313e29267414e4e3bf0d3de1caf9cb439b64aaf (patch)
tree5de4ceb0d4dcf094cbb41cf3968df564d4e88976 /fs/ufs/super.c
parentcbcae39fa1cc16c0fb199223f5ec1aea5f4c7b2d (diff)
[PATCH] ufs2 write: inodes write
This patch adds into write inode path function to write UFS2 inode, and modifys allocate inode path to allocate and init additional inode chunks. Also some cleanups: - remove not used parameters in some functions - remove i_gen field from ufs_inode_info structure, there is i_generation in inode structure with same purposes. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ufs/super.c')
-rw-r--r--fs/ufs/super.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 1427e44bfd2a..cf74548aa85a 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -95,14 +95,16 @@
/*
* Print contents of ufs_super_block, useful for debugging
*/
-static void ufs_print_super_stuff(struct super_block *sb, unsigned flags,
+static void ufs_print_super_stuff(struct super_block *sb,
struct ufs_super_block_first *usb1,
struct ufs_super_block_second *usb2,
struct ufs_super_block_third *usb3)
{
+ u32 magic = fs32_to_cpu(sb, usb3->fs_magic);
+
printk("ufs_print_super_stuff\n");
- printk(" magic: 0x%x\n", fs32_to_cpu(sb, usb3->fs_magic));
- if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
+ printk(" magic: 0x%x\n", magic);
+ if (fs32_to_cpu(sb, usb3->fs_magic) == UFS2_MAGIC) {
printk(" fs_size: %llu\n", (unsigned long long)
fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size));
printk(" fs_dsize: %llu\n", (unsigned long long)
@@ -119,6 +121,12 @@ static void ufs_print_super_stuff(struct super_block *sb, unsigned flags,
printk(" cs_nbfree(No of free blocks): %llu\n",
(unsigned long long)
fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_nbfree));
+ printk(KERN_INFO" cs_nifree(Num of free inodes): %llu\n",
+ (unsigned long long)
+ fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nifree));
+ printk(KERN_INFO" cs_nffree(Num of free frags): %llu\n",
+ (unsigned long long)
+ fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree));
} else {
printk(" sblkno: %u\n", fs32_to_cpu(sb, usb1->fs_sblkno));
printk(" cblkno: %u\n", fs32_to_cpu(sb, usb1->fs_cblkno));
@@ -201,7 +209,7 @@ static void ufs_print_cylinder_stuff(struct super_block *sb,
printk("\n");
}
#else
-# define ufs_print_super_stuff(sb, flags, usb1, usb2, usb3) /**/
+# define ufs_print_super_stuff(sb, usb1, usb2, usb3) /**/
# define ufs_print_cylinder_stuff(sb, cg) /**/
#endif /* CONFIG_UFS_DEBUG */
@@ -424,7 +432,6 @@ static int ufs_read_cylinder_structures(struct super_block *sb)
{
struct ufs_sb_info *sbi = UFS_SB(sb);
struct ufs_sb_private_info *uspi = sbi->s_uspi;
- unsigned flags = sbi->s_flags;
struct ufs_buffer_head * ubh;
unsigned char * base, * space;
unsigned size, blks, i;
@@ -448,11 +455,7 @@ static int ufs_read_cylinder_structures(struct super_block *sb)
if (i + uspi->s_fpb > blks)
size = (blks - i) * uspi->s_fsize;
- if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
- ubh = ubh_bread(sb,
- fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_csaddr) + i, size);
- else
- ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
+ ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
if (!ubh)
goto failed;
@@ -547,6 +550,7 @@ static void ufs_put_cstotal(struct super_block *sb)
cpu_to_fs32(sb, uspi->cs_total.cs_nffree);
}
ubh_mark_buffer_dirty(USPI_UBH(uspi));
+ ufs_print_super_stuff(sb, usb1, usb2, usb3);
UFSD("EXIT\n");
}
@@ -574,7 +578,9 @@ static void ufs_put_super_internal(struct super_block *sb)
size = uspi->s_bsize;
if (i + uspi->s_fpb > blks)
size = (blks - i) * uspi->s_fsize;
+
ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
+
ubh_memcpyubh (ubh, space, size);
space += size;
ubh_mark_buffer_uptodate (ubh, 1);
@@ -888,7 +894,7 @@ magic_found:
}
- ufs_print_super_stuff(sb, flags, usb1, usb2, usb3);
+ ufs_print_super_stuff(sb, usb1, usb2, usb3);
/*
* Check, if file system was correctly unmounted.
@@ -971,7 +977,12 @@ magic_found:
uspi->s_npsect = ufs_get_fs_npsect(sb, usb1, usb3);
uspi->s_interleave = fs32_to_cpu(sb, usb1->fs_interleave);
uspi->s_trackskew = fs32_to_cpu(sb, usb1->fs_trackskew);
- uspi->s_csaddr = fs32_to_cpu(sb, usb1->fs_csaddr);
+
+ if (uspi->fs_magic == UFS2_MAGIC)
+ uspi->s_csaddr = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_csaddr);
+ else
+ uspi->s_csaddr = fs32_to_cpu(sb, usb1->fs_csaddr);
+
uspi->s_cssize = fs32_to_cpu(sb, usb1->fs_cssize);
uspi->s_cgsize = fs32_to_cpu(sb, usb1->fs_cgsize);
uspi->s_ntrak = fs32_to_cpu(sb, usb1->fs_ntrak);
@@ -1058,7 +1069,6 @@ static void ufs_write_super(struct super_block *sb)
unsigned flags;
lock_kernel();
-
UFSD("ENTER\n");
flags = UFS_SB(sb)->s_flags;
uspi = UFS_SB(sb)->s_uspi;