linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel@redhat.com, Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH v6 2/9] iomap: Mark newly allocated buffer heads as new
Date: Sat,  2 Jun 2018 11:57:10 +0200	[thread overview]
Message-ID: <20180602095717.31641-3-agruenba@redhat.com> (raw)
In-Reply-To: <20180602095717.31641-1-agruenba@redhat.com>

In iomap_to_bh, not only mark buffer heads in IOMAP_UNWRITTEN maps as
new, but also buffer heads in IOMAP_MAPPED maps with the IOMAP_F_NEW
flag set.  This will be used by filesystems like gfs2, which allocate
blocks in iomap->begin.

Minor corrections to the comment for IOMAP_UNWRITTEN maps.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/buffer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 249b83fafe48..5220d9efcd18 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1900,15 +1900,15 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
 		break;
 	case IOMAP_UNWRITTEN:
 		/*
-		 * For unwritten regions, we always need to ensure that
-		 * sub-block writes cause the regions in the block we are not
-		 * writing to are zeroed. Set the buffer as new to ensure this.
+		 * For unwritten regions, we always need to ensure that regions
+		 * in the block we are not writing to are zeroed. Mark the
+		 * buffer as new to ensure this.
 		 */
 		set_buffer_new(bh);
 		set_buffer_unwritten(bh);
 		/* FALLTHRU */
 	case IOMAP_MAPPED:
-		if (offset >= i_size_read(inode))
+		if ((iomap->flags & IOMAP_F_NEW) || offset >= i_size_read(inode))
 			set_buffer_new(bh);
 		bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
 				inode->i_blkbits;
-- 
2.17.0

  parent reply	other threads:[~2018-06-02  9:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02  9:57 [PATCH v6 0/9] gfs2 iomap write support Andreas Gruenbacher
2018-06-02  9:57 ` [PATCH v6 1/9] iomap: inline data should be an iomap type, not a flag Andreas Gruenbacher
2018-06-02  9:57 ` Andreas Gruenbacher [this message]
2018-06-02 16:58   ` [PATCH v6 2/9] iomap: Mark newly allocated buffer heads as new Christoph Hellwig
2018-06-02  9:57 ` [PATCH v6 3/9] iomap: Complete partial direct I/O writes synchronously Andreas Gruenbacher
2018-06-02 16:58   ` Christoph Hellwig
2018-06-02  9:57 ` [PATCH v6 4/9] iomap: Generic inline data handling Andreas Gruenbacher
2018-06-02 17:04   ` Christoph Hellwig
2018-06-04 12:02     ` Andreas Grünbacher
2018-06-04 12:12       ` Christoph Hellwig
2018-06-04 17:01         ` Andreas Grünbacher
2018-06-02  9:57 ` [PATCH v6 5/9] iomap: Add write_end iomap operation Andreas Gruenbacher
2018-06-02 17:06   ` Christoph Hellwig
2018-06-04 12:03     ` Andreas Grünbacher
2018-06-02  9:57 ` [PATCH v6 6/9] gfs2: iomap buffered write support Andreas Gruenbacher
2018-06-02  9:57 ` [PATCH v6 7/9] gfs2: gfs2_extent_length cleanup Andreas Gruenbacher
2018-06-02  9:57 ` [PATCH v6 8/9] gfs2: iomap direct I/O support Andreas Gruenbacher
2018-06-02  9:57 ` [PATCH v6 9/9] gfs2: Remove gfs2_write_{begin,end} Andreas Gruenbacher

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=20180602095717.31641-3-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).