aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/dir.c2
-rw-r--r--fs/ext2/ioctl.c8
-rw-r--r--fs/ext2/super.c30
-rw-r--r--fs/ext2/xattr.c5
4 files changed, 25 insertions, 20 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 3e7a84a1e509..0b02ba9642d2 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -248,7 +248,7 @@ static int
248ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) 248ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
249{ 249{
250 loff_t pos = filp->f_pos; 250 loff_t pos = filp->f_pos;
251 struct inode *inode = filp->f_dentry->d_inode; 251 struct inode *inode = filp->f_path.dentry->d_inode;
252 struct super_block *sb = inode->i_sb; 252 struct super_block *sb = inode->i_sb;
253 unsigned int offset = pos & ~PAGE_CACHE_MASK; 253 unsigned int offset = pos & ~PAGE_CACHE_MASK;
254 unsigned long n = pos >> PAGE_CACHE_SHIFT; 254 unsigned long n = pos >> PAGE_CACHE_SHIFT;
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 1dfba77eab10..4b099d310712 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -44,6 +44,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
44 if (!S_ISDIR(inode->i_mode)) 44 if (!S_ISDIR(inode->i_mode))
45 flags &= ~EXT2_DIRSYNC_FL; 45 flags &= ~EXT2_DIRSYNC_FL;
46 46
47 mutex_lock(&inode->i_mutex);
47 oldflags = ei->i_flags; 48 oldflags = ei->i_flags;
48 49
49 /* 50 /*
@@ -53,13 +54,16 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
53 * This test looks nicer. Thanks to Pauline Middelink 54 * This test looks nicer. Thanks to Pauline Middelink
54 */ 55 */
55 if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { 56 if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) {
56 if (!capable(CAP_LINUX_IMMUTABLE)) 57 if (!capable(CAP_LINUX_IMMUTABLE)) {
58 mutex_unlock(&inode->i_mutex);
57 return -EPERM; 59 return -EPERM;
60 }
58 } 61 }
59 62
60 flags = flags & EXT2_FL_USER_MODIFIABLE; 63 flags = flags & EXT2_FL_USER_MODIFIABLE;
61 flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; 64 flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
62 ei->i_flags = flags; 65 ei->i_flags = flags;
66 mutex_unlock(&inode->i_mutex);
63 67
64 ext2_set_inode_flags(inode); 68 ext2_set_inode_flags(inode);
65 inode->i_ctime = CURRENT_TIME_SEC; 69 inode->i_ctime = CURRENT_TIME_SEC;
@@ -86,7 +90,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
86#ifdef CONFIG_COMPAT 90#ifdef CONFIG_COMPAT
87long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 91long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
88{ 92{
89 struct inode *inode = file->f_dentry->d_inode; 93 struct inode *inode = file->f_path.dentry->d_inode;
90 int ret; 94 int ret;
91 95
92 /* These are just misnamed, they actually get/put from/to user an int */ 96 /* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index d8b9abd95d07..6347c2dbdd81 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -135,12 +135,12 @@ static void ext2_put_super (struct super_block * sb)
135 return; 135 return;
136} 136}
137 137
138static kmem_cache_t * ext2_inode_cachep; 138static struct kmem_cache * ext2_inode_cachep;
139 139
140static struct inode *ext2_alloc_inode(struct super_block *sb) 140static struct inode *ext2_alloc_inode(struct super_block *sb)
141{ 141{
142 struct ext2_inode_info *ei; 142 struct ext2_inode_info *ei;
143 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, SLAB_KERNEL); 143 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
144 if (!ei) 144 if (!ei)
145 return NULL; 145 return NULL;
146#ifdef CONFIG_EXT2_FS_POSIX_ACL 146#ifdef CONFIG_EXT2_FS_POSIX_ACL
@@ -156,7 +156,7 @@ static void ext2_destroy_inode(struct inode *inode)
156 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); 156 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
157} 157}
158 158
159static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 159static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
160{ 160{
161 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; 161 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
162 162
@@ -597,8 +597,6 @@ static int ext2_check_descriptors (struct super_block * sb)
597 return 1; 597 return 1;
598} 598}
599 599
600#define log2(n) ffz(~(n))
601
602/* 600/*
603 * Maximal file size. There is a direct, and {,double-,triple-}indirect 601 * Maximal file size. There is a direct, and {,double-,triple-}indirect
604 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. 602 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks.
@@ -834,9 +832,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
834 sbi->s_sbh = bh; 832 sbi->s_sbh = bh;
835 sbi->s_mount_state = le16_to_cpu(es->s_state); 833 sbi->s_mount_state = le16_to_cpu(es->s_state);
836 sbi->s_addr_per_block_bits = 834 sbi->s_addr_per_block_bits =
837 log2 (EXT2_ADDR_PER_BLOCK(sb)); 835 ilog2 (EXT2_ADDR_PER_BLOCK(sb));
838 sbi->s_desc_per_block_bits = 836 sbi->s_desc_per_block_bits =
839 log2 (EXT2_DESC_PER_BLOCK(sb)); 837 ilog2 (EXT2_DESC_PER_BLOCK(sb));
840 838
841 if (sb->s_magic != EXT2_SUPER_MAGIC) 839 if (sb->s_magic != EXT2_SUPER_MAGIC)
842 goto cantfind_ext2; 840 goto cantfind_ext2;
@@ -1090,8 +1088,10 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1090{ 1088{
1091 struct super_block *sb = dentry->d_sb; 1089 struct super_block *sb = dentry->d_sb;
1092 struct ext2_sb_info *sbi = EXT2_SB(sb); 1090 struct ext2_sb_info *sbi = EXT2_SB(sb);
1091 struct ext2_super_block *es = sbi->s_es;
1093 unsigned long overhead; 1092 unsigned long overhead;
1094 int i; 1093 int i;
1094 u64 fsid;
1095 1095
1096 if (test_opt (sb, MINIX_DF)) 1096 if (test_opt (sb, MINIX_DF))
1097 overhead = 0; 1097 overhead = 0;
@@ -1104,7 +1104,7 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1104 * All of the blocks before first_data_block are 1104 * All of the blocks before first_data_block are
1105 * overhead 1105 * overhead
1106 */ 1106 */
1107 overhead = le32_to_cpu(sbi->s_es->s_first_data_block); 1107 overhead = le32_to_cpu(es->s_first_data_block);
1108 1108
1109 /* 1109 /*
1110 * Add the overhead attributed to the superblock and 1110 * Add the overhead attributed to the superblock and
@@ -1125,14 +1125,18 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1125 1125
1126 buf->f_type = EXT2_SUPER_MAGIC; 1126 buf->f_type = EXT2_SUPER_MAGIC;
1127 buf->f_bsize = sb->s_blocksize; 1127 buf->f_bsize = sb->s_blocksize;
1128 buf->f_blocks = le32_to_cpu(sbi->s_es->s_blocks_count) - overhead; 1128 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - overhead;
1129 buf->f_bfree = ext2_count_free_blocks(sb); 1129 buf->f_bfree = ext2_count_free_blocks(sb);
1130 buf->f_bavail = buf->f_bfree - le32_to_cpu(sbi->s_es->s_r_blocks_count); 1130 buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
1131 if (buf->f_bfree < le32_to_cpu(sbi->s_es->s_r_blocks_count)) 1131 if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
1132 buf->f_bavail = 0; 1132 buf->f_bavail = 0;
1133 buf->f_files = le32_to_cpu(sbi->s_es->s_inodes_count); 1133 buf->f_files = le32_to_cpu(es->s_inodes_count);
1134 buf->f_ffree = ext2_count_free_inodes (sb); 1134 buf->f_ffree = ext2_count_free_inodes(sb);
1135 buf->f_namelen = EXT2_NAME_LEN; 1135 buf->f_namelen = EXT2_NAME_LEN;
1136 fsid = le64_to_cpup((void *)es->s_uuid) ^
1137 le64_to_cpup((void *)es->s_uuid + sizeof(u64));
1138 buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
1139 buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
1136 return 0; 1140 return 0;
1137} 1141}
1138 1142
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index af52a7f8b291..247efd0b51d6 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -342,12 +342,9 @@ static void ext2_xattr_update_super_block(struct super_block *sb)
342 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR)) 342 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR))
343 return; 343 return;
344 344
345 lock_super(sb); 345 EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR);
346 EXT2_SB(sb)->s_es->s_feature_compat |=
347 cpu_to_le32(EXT2_FEATURE_COMPAT_EXT_ATTR);
348 sb->s_dirt = 1; 346 sb->s_dirt = 1;
349 mark_buffer_dirty(EXT2_SB(sb)->s_sbh); 347 mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
350 unlock_super(sb);
351} 348}
352 349
353/* 350/*