Skip to content

Commit bc86256

Browse files
dedekindAl Viro
authored andcommitted
affs: stop setting bm_flags
AFFS stores values '1' and '2' in 'bm_flags', and I fail to see any logic when it prefers one or another. AFFS writes '1' only from '->put_super()', while '->sync_fs()' and '->write_super()' store value '2'. So on the first glance, it looks like we want to have '1' if we unmount. However, this does not really happen in these cases: 1. superblock is written via 'write_super()' then we unmount; 2. we re-mount R/O, then unmount. which are quite typical. I could not find good documentation describing this field, except of one random piece of documentation in the internet which says that -1 means that the root block is valid, which is not consistent with what we have in the Linux AFFS driver. Jan Kara commented on this: "I have some vague recollection that on Amiga boolean was usually encoded as: 0 == false, ~0 == -1 == true. But it has been ages..." Thus, my conclusion is that value of '1' is as good as value of '2' and we can just always use '2'. An Jan Kara suggested to go further: "generally bm_flags handling looks strange. If they are 0, we mount fs read only and thus cannot change them. If they are != 0, we write 2 there. So IMHO if you just removed bm_flags setting, nothing will really happen." So this patch removes the bm_flags setting completely. This makes the "clean" argument of the 'affs_commit_super()' function unneeded, so it is also removed. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent fdb1335 commit bc86256

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎fs/affs/super.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ static int affs_statfs(struct dentry *dentry, struct kstatfs *buf);
2525
static int affs_remount (struct super_block *sb, int *flags, char *data);
2626

2727
static void
28-
affs_commit_super(struct super_block *sb, int wait, int clean)
28+
affs_commit_super(struct super_block *sb, int wait)
2929
{
3030
struct affs_sb_info *sbi = AFFS_SB(sb);
3131
struct buffer_head *bh = sbi->s_root_bh;
3232
struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh);
3333

34-
tail->bm_flag = cpu_to_be32(clean);
3534
secs_to_datestamp(get_seconds(), &tail->disk_change);
3635
affs_fix_checksum(sb, bh);
3736
mark_buffer_dirty(bh);
@@ -46,7 +45,7 @@ affs_put_super(struct super_block *sb)
4645
pr_debug("AFFS: put_super()\n");
4746

4847
if (!(sb->s_flags & MS_RDONLY) && sb->s_dirt)
49-
affs_commit_super(sb, 1, 1);
48+
affs_commit_super(sb, 1);
5049

5150
kfree(sbi->s_prefix);
5251
affs_free_bitmap(sb);
@@ -60,7 +59,7 @@ affs_write_super(struct super_block *sb)
6059
{
6160
lock_super(sb);
6261
if (!(sb->s_flags & MS_RDONLY))
63-
affs_commit_super(sb, 1, 2);
62+
affs_commit_super(sb, 1);
6463
sb->s_dirt = 0;
6564
unlock_super(sb);
6665

@@ -71,7 +70,7 @@ static int
7170
affs_sync_fs(struct super_block *sb, int wait)
7271
{
7372
lock_super(sb);
74-
affs_commit_super(sb, wait, 2);
73+
affs_commit_super(sb, wait);
7574
sb->s_dirt = 0;
7675
unlock_super(sb);
7776
return 0;

0 commit comments

Comments
 (0)