mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francis Moreau <francis.moro@gmail.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Question regarding concurrent accesses through block device and fs
Date: Thu, 19 Feb 2009 12:07:42 +0100	[thread overview]
Message-ID: <38b2ab8a0902190307p214a6928v2f66b8ad5e9564e6@mail.gmail.com> (raw)
In-Reply-To: <m2hc2yulrw.fsf@gmail.com>

[ Resend to LKLM, hopping to get a wider audience ;) and to Andrew Morton since
  he wrote that part of the code, I think ]

Hello,

I have a question regarding the page cache/buffer heads behaviour when
some blocks are accessed through a regular file and through the block
dev hosting this file.

First it looks like when accessing some blocks through a block device,
the same mechanisms are used as when reading a file through a file
system: the page cache is used.

That means that a block could be mapped by several buffers at the same
time.

I don't see any issues to this (if we agree that the behaviour is undefined
in that case) but looking at __block_prepare_write(), it seems that we don't
want this to happen since it does:

       [...]
       if (buffer_new(bh)) {
               unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr);
               [...]
       }

where unmap_underlying_metadata() unmaps the blockdev buffer
which maps b_blocknr block.

This code seems to catch only the case where the buffer is new (I don't
see why only this case is treated).

Also this call seems unneeded if __block_prepare_write() is called
when writing through the block dev since we already know that the buffer
doesn't exist (we are here to create it).

I already read the comment of the function unmap_underlying_metadata()
but I failed to understand it...

Could anybody tell me what is the actual policy ?


thanks
--
Francis

       reply	other threads:[~2009-02-19 11:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2hc2yulrw.fsf@gmail.com>
2009-02-19 11:07 ` Francis Moreau [this message]
2009-02-19 13:44   ` Nick Piggin
2009-02-20 14:10     ` Francis Moreau
2009-02-23  3:58       ` Nick Piggin
2009-03-01 14:42         ` Francis Moreau
2009-03-01 15:32           ` Nick Piggin
2009-03-01 21:07             ` Francis Moreau
2009-03-02  7:11               ` Nick Piggin
2009-03-02 13:30                 ` Francis Moreau
2009-03-03  3:52                   ` Nick Piggin
2009-03-12  8:05                     ` Francis Moreau
2009-03-12  8:22                       ` Nick Piggin
2009-03-12  9:00                         ` Francis Moreau
2009-03-12  9:12                           ` Nick Piggin

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=38b2ab8a0902190307p214a6928v2f66b8ad5e9564e6@mail.gmail.com \
    --to=francis.moro@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®