[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <TY2PR01MB2875C88DD10CC13D0C70DE1690610@TY2PR01MB2875.jpnprd01.prod.outlook.com>
Date: Tue, 14 Jul 2020 01:56:23 +0000
From: "Kohada.Tetsuhiro@...MitsubishiElectric.co.jp"
<Kohada.Tetsuhiro@...MitsubishiElectric.co.jp>
To: 'Namjae Jeon' <namjae.jeon@...sung.com>
CC: "Mori.Takahiro@...MitsubishiElectric.co.jp"
<Mori.Takahiro@...MitsubishiElectric.co.jp>,
"Motai.Hirotaka@...MitsubishiElectric.co.jp"
<Motai.Hirotaka@...MitsubishiElectric.co.jp>,
'Sungjong Seo' <sj1557.seo@...sung.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
'Tetsuhiro Kohada'' <kohada.t2@...il.com>
Subject: RE: [PATCH] exfat: retain 'VolumeFlags' properly
Thanks for your reply.
> > Also, rename ERR_MEDIUM to MED_FAILURE.
> I think that MEDIA_FAILURE looks better.
I think so too.
If so, should I change VOL_DIRTY to VOLUME_DIRTY?
> > -int exfat_set_vol_flags(struct super_block *sb, unsigned short
> > new_flag)
> > +int exfat_set_vol_flags(struct super_block *sb, unsigned short
> > +new_flags)
> > {
> > struct exfat_sb_info *sbi = EXFAT_SB(sb);
> > struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
> > bool sync;
> If dirty bit is set in on-disk volume flags, we can just return 0 at the beginning of this function ?
That's right.
Neither 'set VOL_DIRTY' nor 'set VOL_CLEAN' makes a change to volume flags.
> > + if (new_flags == VOL_CLEAN)
> > + new_flags = (sbi->vol_flags & ~VOL_DIRTY) | sbi->vol_flags_noclear;
> > + else
> > + new_flags |= sbi->vol_flags;
> > +
> > /* flags are not changed */
> > - if (sbi->vol_flag == new_flag)
> > + if (sbi->vol_flags == new_flags)
> > return 0;
> >
> > - sbi->vol_flag = new_flag;
> > + sbi->vol_flags = new_flags;
> >
> > /* skip updating volume dirty flag,
> > * if this volume has been mounted with read-only @@ -114,9 +119,9
> > @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
> > if (sb_rdonly(sb))
> > return 0;
> >
> > - p_boot->vol_flags = cpu_to_le16(new_flag);
> > + p_boot->vol_flags = cpu_to_le16(new_flags);
> How about set or clear only dirty bit to on-disk volume flags instead of using
> sbi->vol_flags_noclear ?
> if (set)
> p_boot->vol_flags |= cpu_to_le16(VOL_DIRTY);
> else
> p_boot->vol_flags &= cpu_to_le16(~VOL_DIRTY);
In this way, the initial VOL_DIRTY cannot be retained.
The purpose of this patch is to avoid losing the initial VOL_DIRTY and MED_FAILURE.
Furthermore, I'm also thinking of setting MED_FAILURE.
However, the formula for 'new_flags' may be a bit complicated.
Is it better to change to the following?
if (new_flags == VOL_CLEAN)
new_flags = sbi->vol_flags & ~VOL_DIRTY
else
new_flags |= sbi->vol_flags;
new_flags |= sbi->vol_flags_noclear;
one more point,
Is there a better name than 'vol_flags_noclear'?
(I can't come up with a good name anymore)
BR
---
Kohada Tetsuhiro <Kohada.Tetsuhiro@...MitsubishiElectric.co.jp>
Powered by blists - more mailing lists