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 v7 05/12] fs: allow to always dirty inode in __generic_write_end
Date: Mon, 4 Jun 2018 14:37:22 +0200 [thread overview]
Message-ID: <20180604123729.23414-6-agruenba@redhat.com> (raw)
In-Reply-To: <20180604123729.23414-1-agruenba@redhat.com>
In __generic_write_end, we usually dirty the inode only when the file
size changes. Allow to dirty the inode even when the file size stays
the same; this will be used when writing to inline data stored in the
inode.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/buffer.c | 9 ++++-----
fs/internal.h | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index cb5bbf22b1ce..a59d281ca51e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2078,10 +2078,9 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
EXPORT_SYMBOL(block_write_begin);
int __generic_write_end(struct inode *inode, loff_t pos, unsigned copied,
- struct page *page)
+ struct page *page, bool dirty_inode)
{
loff_t old_size = inode->i_size;
- bool i_size_changed = false;
/*
* No need to use i_size_read() here, the i_size cannot change under us
@@ -2092,7 +2091,7 @@ int __generic_write_end(struct inode *inode, loff_t pos, unsigned copied,
*/
if (pos + copied > inode->i_size) {
i_size_write(inode, pos + copied);
- i_size_changed = true;
+ dirty_inode = true;
}
unlock_page(page);
@@ -2106,7 +2105,7 @@ int __generic_write_end(struct inode *inode, loff_t pos, unsigned copied,
* ordering of page lock and transaction start for journaling
* filesystems.
*/
- if (i_size_changed)
+ if (dirty_inode)
mark_inode_dirty(inode);
return copied;
}
@@ -2152,7 +2151,7 @@ int generic_write_end(struct file *file, struct address_space *mapping,
struct page *page, void *fsdata)
{
copied = block_write_end(file, mapping, pos, len, copied, page, fsdata);
- return __generic_write_end(mapping->host, pos, copied, page);
+ return __generic_write_end(mapping->host, pos, copied, page, false);
}
EXPORT_SYMBOL(generic_write_end);
diff --git a/fs/internal.h b/fs/internal.h
index 4a18bdbd2214..8572af552285 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -44,7 +44,7 @@ extern void guard_bio_eod(int rw, struct bio *bio);
extern int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
get_block_t *get_block, struct iomap *iomap);
int __generic_write_end(struct inode *inode, loff_t pos, unsigned copied,
- struct page *page);
+ struct page *page, bool dirty_inode);
/*
* char_dev.c
--
2.17.0
next prev parent reply other threads:[~2018-06-04 12:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 12:37 [PATCH v7 00/12] gfs2 iomap write support Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 01/12] iomap: inline data should be an iomap type, not a flag Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 02/12] iomap: Mark newly allocated buffer heads as new Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 03/12] iomap: Complete partial direct I/O writes synchronously Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 04/12] fs: factor out a __generic_write_end helper Andreas Gruenbacher
2018-06-04 12:37 ` Andreas Gruenbacher [this message]
2018-06-04 12:48 ` [PATCH v7 05/12] fs: allow to always dirty inode in __generic_write_end Christoph Hellwig
2018-06-04 16:24 ` Andreas Grünbacher
2018-06-04 12:37 ` [PATCH v7 06/12] iomap: Generic inline data handling Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 07/12] iomap: Add page_write_end iomap hook Andreas Gruenbacher
2018-06-04 12:50 ` Christoph Hellwig
2018-06-04 16:40 ` Andreas Grünbacher
2018-06-04 12:37 ` [PATCH v7 08/12] gfs2: iomap buffered write support Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 09/12] gfs2: gfs2_extent_length cleanup Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 10/12] gfs2: iomap direct I/O support Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 11/12] gfs2: Remove gfs2_write_{begin,end} Andreas Gruenbacher
2018-06-04 12:37 ` [PATCH v7 12/12] iomap: Put struct iomap_ops into struct iomap Andreas Gruenbacher
2018-06-04 12:52 ` Christoph Hellwig
2018-06-04 17:00 ` Andreas Grünbacher
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=20180604123729.23414-6-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).