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


Groups > linux.kernel > #1654201

[PATCH v5 09/17] block: convert to errseq_t based writeback error tracking

From Jeff Layton <jlayton@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v5 09/17] block: convert to errseq_t based writeback error tracking
Date 2017-05-31 14:50 +0200
Message-ID <tNbez-4Mk-37@gated-at.bofh.it> (permalink)
References <tNbex-4Mk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Fairly straightforward conversion. In fsync, just use the file->f_wb_err
value as a "since" value. At the end, call filemap_report_wb_err to
advance the cursor in it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/block_dev.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4d62fe771587..0d5f849e2a18 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -622,11 +622,13 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 {
 	struct inode *bd_inode = bdev_file_inode(filp);
 	struct block_device *bdev = I_BDEV(bd_inode);
-	int error;
+	int error, wberr;
+	errseq_t since = READ_ONCE(filp->f_wb_err);
 	
-	error = filemap_write_and_wait_range(filp->f_mapping, start, end);
+	error = filemap_write_and_wait_range_since(filp->f_mapping, start,
+							end, since);
 	if (error)
-		return error;
+		goto out;
 
 	/*
 	 * There is no need to serialise calls to blkdev_issue_flush with
@@ -637,6 +639,10 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 	if (error == -EOPNOTSUPP)
 		error = 0;
 
+out:
+	wberr = filemap_report_wb_err(filp);
+	if (!error)
+		error = wberr;
 	return error;
 }
 EXPORT_SYMBOL(blkdev_fsync);
@@ -801,6 +807,7 @@ static struct file_system_type bd_type = {
 	.name		= "bdev",
 	.mount		= bd_mount,
 	.kill_sb	= kill_anon_super,
+	.fs_flags	= FS_WB_ERRSEQ,
 };
 
 struct super_block *blockdev_superblock __read_mostly;
-- 
2.9.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v5 09/17] block: convert to errseq_t based writeback error tracking Jeff Layton <jlayton@redhat.com> - 2017-05-31 14:50 +0200

csiph-web