Skip to content

Commit 722c55d

Browse files
Christoph HellwigChristoph Hellwig
authored andcommitted
hfsplus: remove superflous rootflags field in hfsplus_inode_info
The rootflags field in hfsplus_inode_info only caches the immutable and append-only flags in the VFS inode, so we can easily get rid of it. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
1 parent f6089ff commit 722c55d

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

‎fs/hfsplus/catalog.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ static void hfsplus_set_perms(struct inode *inode, struct hfsplus_perm *perms)
7777
perms->rootflags |= HFSPLUS_FLG_APPEND;
7878
else
7979
perms->rootflags &= ~HFSPLUS_FLG_APPEND;
80-
HFSPLUS_I(inode)->rootflags = perms->rootflags;
8180
HFSPLUS_I(inode)->userflags = perms->userflags;
8281
perms->mode = cpu_to_be16(inode->i_mode);
8382
perms->owner = cpu_to_be32(inode->i_uid);

‎fs/hfsplus/hfsplus_fs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ struct hfsplus_inode_info {
188188
* Protected by i_mutex.
189189
*/
190190
sector_t fs_blocks;
191-
u8 rootflags, userflags; /* BSD system and user file flags */
191+
u8 userflags; /* BSD user file flags */
192192
struct list_head open_dir_list;
193193
loff_t phys_size;
194194

‎fs/hfsplus/inode.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ static void hfsplus_get_perms(struct inode *inode, struct hfsplus_perm *perms, i
241241
mode = S_IFREG | ((S_IRUGO|S_IWUGO) & ~(sbi->umask));
242242
inode->i_mode = mode;
243243

244-
HFSPLUS_I(inode)->rootflags = perms->rootflags;
245244
HFSPLUS_I(inode)->userflags = perms->userflags;
246245
if (perms->rootflags & HFSPLUS_FLG_IMMUTABLE)
247246
inode->i_flags |= S_IMMUTABLE;

‎fs/hfsplus/ioctl.c‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags)
2626
struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
2727
unsigned int flags = 0;
2828

29-
if (hip->rootflags & HFSPLUS_FLG_IMMUTABLE)
29+
if (inode->i_flags & S_IMMUTABLE)
3030
flags |= FS_IMMUTABLE_FL;
31-
if (hip->rootflags & HFSPLUS_FLG_APPEND)
31+
if (inode->i_flags |= S_APPEND)
3232
flags |= FS_APPEND_FL;
3333
if (hip->userflags & HFSPLUS_FLG_NODUMP)
3434
flags |= FS_NODUMP_FL;
@@ -59,8 +59,8 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
5959

6060
mutex_lock(&inode->i_mutex);
6161

62-
if (flags & (FS_IMMUTABLE_FL|FS_APPEND_FL) ||
63-
hip->rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) {
62+
if ((flags & (FS_IMMUTABLE_FL|FS_APPEND_FL)) ||
63+
inode->i_flags & (S_IMMUTABLE|S_APPEND)) {
6464
if (!capable(CAP_LINUX_IMMUTABLE)) {
6565
err = -EPERM;
6666
goto out_unlock_inode;
@@ -72,20 +72,17 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
7272
err = -EOPNOTSUPP;
7373
goto out_unlock_inode;
7474
}
75-
if (flags & FS_IMMUTABLE_FL) {
75+
76+
if (flags & FS_IMMUTABLE_FL)
7677
inode->i_flags |= S_IMMUTABLE;
77-
hip->rootflags |= HFSPLUS_FLG_IMMUTABLE;
78-
} else {
78+
else
7979
inode->i_flags &= ~S_IMMUTABLE;
80-
hip->rootflags &= ~HFSPLUS_FLG_IMMUTABLE;
81-
}
82-
if (flags & FS_APPEND_FL) {
80+
81+
if (flags & FS_APPEND_FL)
8382
inode->i_flags |= S_APPEND;
84-
hip->rootflags |= HFSPLUS_FLG_APPEND;
85-
} else {
83+
else
8684
inode->i_flags &= ~S_APPEND;
87-
hip->rootflags &= ~HFSPLUS_FLG_APPEND;
88-
}
85+
8986
if (flags & FS_NODUMP_FL)
9087
hip->userflags |= HFSPLUS_FLG_NODUMP;
9188
else

0 commit comments

Comments
 (0)