linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Hou Tao <houtao1@huawei.com>
Cc: v9fs-developer@lists.sourceforge.net, lucho@ionkov.net,
	ericvh@gmail.com, linux-fsdevel@vger.kernel.org,
	xingaopeng@huawei.com
Subject: Re: [PATCH v3 2/2] 9p: use i_lock to protect update of inode->i_blocks under 32-bit
Date: Thu, 24 Jan 2019 15:53:04 +0100	[thread overview]
Message-ID: <20190124145304.GA8716@nautica> (raw)
In-Reply-To: <20190124144539.GA1457@nautica>

Dominique Martinet wrote on Thu, Jan 24, 2019:
> > >  - if I create a file outside of 9p and stat it, for example starting
> > >  with 400 bytes, it starts with 8 blocks then the number of blocks
> > >  increase by 1 everytime 512 bytes are written regardless of initial
> > >  size.
> >
> > The initial i_blocks comes from the underlying filesystem, so I think 8 blocks
> > just mean the block size of the underlying filesystem is 4KB. If another 512 bytes
> > are written into the file, inode_add_bytes() will increase i_blocks by one instead of
> > fetching i_blocks from server, though i_blocks in server side will
> > still be 8.
> 
> Ah, I had only looked at v9fs_stat2inode() which creates the value from
> i_size, not v9fs_stat2inode_dotl().
> v9fs_stat2inode_dotl() does take the value from the RPC, and then 8 is
> indeed correct -- it will just be very painful to keep synchronized with
> the underlying fs; we have no ways of knowing when the remote filesystem
> decides to allocate new blocks.
> If for example the write iter only writes 0 and the underlying fs is
> optimized st_blocks might not increase at all.
> 
> > Maybe we should call v9fs_invalidate_inode_attr() in v9fs_write_end() ?
> 
> Hmm, That will probably add quite a lot of RPCs and make the cache
> option rather useless...

Actually I made an interesting point without realizing it myself -
thinking back of the option, I would keep the current behaviour with
cache=none/mmap (as the inode attr will be invalid and refreshed on
every stat anyway - this incidentally probably is why I never noticed
it, cache=none works just fine as far as st_blocks is concerned because
it always returns the underlying storage's block count) and just 100%
fake it for cache=fscache/loose.

Still going to bring this whole subject up in a separate thread to
fsdevel tomorrow, I'll put you and the v9fs-developer list in cc.


Will also add a note to run more testings with various cache
options...

-- 
Dominique

      reply	other threads:[~2019-01-24 14:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  6:35 [PATCH v3 0/2] use i_lock to protect updates of i_blocks & Hou Tao
2019-01-24  6:35 ` [PATCH v3 1/2] 9p: use inode->i_lock to protect i_size_write() under 32-bit Hou Tao
2019-01-24  6:57   ` Dominique Martinet
2019-01-24 11:01     ` Hou Tao
2019-03-02 11:31     ` Hou Tao
2019-03-03  4:57       ` Dominique Martinet
2019-01-24  6:35 ` [PATCH v3 2/2] 9p: use i_lock to protect update of inode->i_blocks " Hou Tao
2019-01-24  7:25   ` Dominique Martinet
2019-01-24 14:03     ` Hou Tao
2019-01-24 14:45       ` Dominique Martinet
2019-01-24 14:53         ` Dominique Martinet [this message]

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=20190124145304.GA8716@nautica \
    --to=asmadeus@codewreck.org \
    --cc=ericvh@gmail.com \
    --cc=houtao1@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=xingaopeng@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).