From: Al Viro <viro@ZenIV.linux.org.uk>
To: Richard Narron <comet.berkeley@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Will B <will.brokenbourgh2877@gmail.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Evgeniy Dushistov <dushistov@mail.ru>
Subject: Re: UFS s_maxbytes bogosity
Date: Thu, 8 Jun 2017 23:15:05 +0100 [thread overview]
Message-ID: <20170608221505.GA3766@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20170608022057.GX6365@ZenIV.linux.org.uk>
On Thu, Jun 08, 2017 at 03:20:57AM +0100, Al Viro wrote:
> On Wed, Jun 07, 2017 at 05:35:31PM -0700, Richard Narron wrote:
>
> > I am willing to test. I just turned on UFS_FS_WRITE for the very first time
> > running 4.12-rc4 and was able to copy a file of more than 2GB from one r/o
> > FreeBSD subpartition to another r/w FreeBSD subpartition.
> >
> > So it is already looking pretty good.
>
> The nasty cases are around short files, especially short files with holes.
> Linear writes as done by cp(1) will do nothing worse than bogus i_blocks
> (and possibly mangled counters in cylinder groups). Random write access
> to short files, OTOH, steps into a lot more codepaths...
>
> As for ->i_blocks, it triggers this:
>
> root@kvm1:/mnt# df .; mkdir a; rmdir a; df .
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/loop0 507420 4504 462340 1% /mnt
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/loop0 507420 4536 462308 1% /mnt
>
> Note the 32Kb (== one block on that ufs2) leaked here.
> Every iteration will leak another one. Similar for long
> symlinks...
Spot the bogosity:
static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi,
struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
{
switch (uspi->s_fpb) {
case 8:
return (*ubh_get_addr (ubh, begin + block) == 0xff);
case 4:
return (*ubh_get_addr (ubh, begin + (block >> 1)) == (0x0f << ((block & 0x01) << 2)));
case 2:
return (*ubh_get_addr (ubh, begin + (block >> 2)) == (0x03 << ((block & 0x03) << 1)));
case 1:
return (*ubh_get_addr (ubh, begin + (block >> 3)) == (0x01 << (block & 0x07)));
}
return 0;
}
with
static inline void _ubh_setblock_(struct ufs_sb_private_info * uspi,
struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
{
switch (uspi->s_fpb) {
case 8:
*ubh_get_addr(ubh, begin + block) = 0xff;
return;
case 4:
*ubh_get_addr(ubh, begin + (block >> 1)) |= (0x0f << ((block & 0x01) << 2));
return;
case 2:
*ubh_get_addr(ubh, begin + (block >> 2)) |= (0x03 << ((block & 0x03) << 1));
return;
case 1:
*ubh_get_addr(ubh, begin + (block >> 3)) |= (0x01 << ((block & 0x07)));
return;
}
}
The only saving grace is that UFS defaults to 8 fragments per block...
next prev parent reply other threads:[~2017-06-08 22:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-04 19:31 UFS s_maxbytes bogosity Linus Torvalds
2017-06-04 21:37 ` Al Viro
2017-06-04 21:58 ` Al Viro
2017-06-04 22:06 ` Al Viro
2017-06-04 23:26 ` Linus Torvalds
2017-06-05 0:11 ` Al Viro
2017-06-05 3:00 ` Linus Torvalds
2017-06-05 3:49 ` Al Viro
2017-06-07 23:48 ` Al Viro
2017-06-08 0:35 ` Richard Narron
2017-06-08 2:20 ` Al Viro
2017-06-08 22:15 ` Al Viro [this message]
2017-06-08 22:36 ` Linus Torvalds
2017-06-09 0:11 ` Richard Narron
2017-06-09 3:35 ` Al Viro
2017-06-09 17:34 ` Al Viro
2017-06-09 21:55 ` Richard Narron
2017-06-10 0:09 ` Richard Narron
2017-06-04 22:32 ` Theodore Ts'o
2017-06-05 0:02 ` Al Viro
2017-06-04 23:23 ` [PATCH 1/1] fs/ufs: Set UFS default maximum bytes per file Richard Narron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170608221505.GA3766@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=comet.berkeley@gmail.com \
--cc=dushistov@mail.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=will.brokenbourgh2877@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.