Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347770 > unrolled thread

[PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page cache

Started by"Darrick J. Wong" <darrick.wong@oracle.com>
First post2016-03-02 05:20 +0100
Last post2016-03-02 12:00 +0100
Articles 4 on this page of 24 — 8 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page cache "Darrick J. Wong" <darrick.wong@oracle.com> - 2016-03-02 05:20 +0100
    [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks "Darrick J. Wong" <darrick.wong@oracle.com> - 2016-03-02 05:20 +0100
      Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Christoph Hellwig <hch@infradead.org> - 2016-03-02 10:30 +0100
      Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-02 20:00 +0100
        Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks "Darrick J. Wong" <darrick.wong@oracle.com> - 2016-03-03 00:00 +0100
          Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-03 01:00 +0100
            Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Theodore Ts'o <tytso@mit.edu> - 2016-03-03 18:10 +0100
              Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-03 19:00 +0100
                Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Christoph Hellwig <hch@infradead.org> - 2016-03-03 19:10 +0100
                Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-03-03 19:20 +0100
                Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Theodore Ts'o <tytso@mit.edu> - 2016-03-03 19:30 +0100
            Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-03-03 19:10 +0100
              Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Christoph Hellwig <hch@infradead.org> - 2016-03-03 19:10 +0100
                Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks "Darrick J. Wong" <darrick.wong@oracle.com> - 2016-03-03 19:20 +0100
                Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-03-03 20:00 +0100
                  Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Theodore Ts'o <tytso@mit.edu> - 2016-03-03 23:50 +0100
                    Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Dave Chinner <david@fromorbit.com> - 2016-03-04 00:20 +0100
                      Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Theodore Ts'o <tytso@mit.edu> - 2016-03-04 01:30 +0100
                  Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Dave Chinner <david@fromorbit.com> - 2016-03-04 00:00 +0100
                    Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of  blocks Thomas Schoebel-Theuer <tst@schoebel-theuer.de> - 2016-03-04 03:40 +0100
              Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-03 19:20 +0100
    Re: [PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page cache Arnd Bergmann <arnd@arndb.de> - 2016-03-02 10:20 +0100
      Re: [PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page  cache Christoph Hellwig <hch@infradead.org> - 2016-03-02 10:50 +0100
        Re: [PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page cache Arnd Bergmann <arnd@arndb.de> - 2016-03-02 12:00 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1349469 — Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2016-03-03 19:20 +0100
SubjectRe: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks
Message-ID<r8G0W-2zu-21@gated-at.bofh.it>
In reply to#1349461
On Thu, Mar 3, 2016 at 10:01 AM, Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>>>>>> "Linus" == Linus Torvalds <torvalds@linux-foundation.org> writes:
>
> Linus> .. but the flag doesn't even set that. Even if you avoid TRIM,
> Linus> there is absolutely zero guarantees that WRITE_SAME would do
> Linus> "real storage blocks full of zeroes backing the LBAs they just
> Linus> wrote out".
>
> That's not entirely true. Writing the blocks may cause them to be
> allocated on the storage device (depending on which flags we feed it in
> WRITE SAME).

Ok, so now we're getting somewhere, with actual _reasons_ why somebody
would want to use one interface over another.

> The filesystems people were wanted the following semantics:
>
>  - deallocate, don't care about contents for future reads (discard)
>  - deallocate, guarantee zeroes on future reads (zeroout)
>  - (re)allocate, guarantee zeroes on future reads (zeroout)
>
> Maybe we just need a better naming scheme...

Yes.

And this does make me think that Christoph is right: this would be so
much better if the block layer just supported fallocate() instead,
which already has those operations.

Right now we have

        if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                return -ENODEV;

so right now the vfs_fallocate() code expliitly disallows block
devices, but that would be easy to expand.

Would people be happy with that kind of patch instead? It would
certainly make all my objections go away..

             Linus

[toc] | [prev] | [next] | [standalone]


#1347875

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 10:20 +0100
Message-ID<r8b6O-5Co-21@gated-at.bofh.it>
In reply to#1347770
On Tuesday 01 March 2016 20:09:32 Darrick J. Wong wrote:
> This is (yet another) repost of the patch series that fixes the
> existing BLKZEROOUT ioctl to invalidate the page cache if the zeroing
> command to the underlying device succeeds.  This patch is against
> 4.5-rc6 and hasn't changed much in months.
> 
> The new BLKZEROOUT ioctl has the same semantics as the old one, but it
> invalidates the page cache to prevent surprising results, just like
> how dio writes invalidate page cache.
> 
> I've incorporated all the feedback I've received into these patches,
> but haven't heard yea or nay or anything at all from the maintainer.
> Will someone please pick this up for 4.6?
> 
> Comments and questions are, as always, welcome.

I'm missing the background on this, just saw the patch fly by,
so sorry if this has been asked before:

Why do you want to invalidate the cache? Is this to save RAM
or is something else going to write here and you have to invalidate
it for correctness?

If you just want to save RAM, would it be possible to instead
point the page cache to the empty zero page to speed up subsequent
reads? Maybe that just causes more complexity than it helps.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1347899 — Re: [PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page cache

FromChristoph Hellwig <hch@infradead.org>
Date2016-03-02 10:50 +0100
SubjectRe: [PATCH v5.1 0/2] create BLKZEROOUT ioctl that invalidates page cache
Message-ID<r8bzQ-5NZ-11@gated-at.bofh.it>
In reply to#1347875
On Wed, Mar 02, 2016 at 10:15:02AM +0100, Arnd Bergmann wrote:
> I'm missing the background on this, just saw the patch fly by,
> so sorry if this has been asked before:
> 
> Why do you want to invalidate the cache? Is this to save RAM
> or is something else going to write here and you have to invalidate
> it for correctness?

BLKZEROOUT can be though as a direct I/O operation - it issues a 
WRITE SAME (or similar) command straight to the device to zero
the specified range.  If there was cached data for this range it would
now be stale.

[toc] | [prev] | [next] | [standalone]


#1347949

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 12:00 +0100
Message-ID<r8cFA-6tO-1@gated-at.bofh.it>
In reply to#1347899
On Wednesday 02 March 2016 01:44:16 Christoph Hellwig wrote:
> On Wed, Mar 02, 2016 at 10:15:02AM +0100, Arnd Bergmann wrote:
> > I'm missing the background on this, just saw the patch fly by,
> > so sorry if this has been asked before:
> > 
> > Why do you want to invalidate the cache? Is this to save RAM
> > or is something else going to write here and you have to invalidate
> > it for correctness?
> 
> BLKZEROOUT can be though as a direct I/O operation - it issues a 
> WRITE SAME (or similar) command straight to the device to zero
> the specified range.  If there was cached data for this range it would
> now be stale.

Ok, got it. Thanks,

	Arnd

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web