1
The following changes since commit e5cd695266c5709308aa95b1baae499e4b5d4544:
1
The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935:
2
2
3
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2018-05-08 17:05:58 +0100)
3
Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-07-29' into staging (2021-07-29 13:17:20 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
git://github.com/stefanha/qemu.git tags/block-pull-request
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to 31be8a2a97ecba7d31a82932286489cac318e9e9:
9
for you to fetch changes up to cc8eecd7f105a1dff5876adeb238a14696061a4a:
10
10
11
block/file-posix: add x-check-page-cache=on|off option (2018-05-11 16:43:05 +0100)
11
MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver (2021-07-29 17:17:34 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block pull request
14
Pull request
15
15
16
* Support -drive cache.direct=off live migration for POSIX files
16
The main fix here is for io_uring. Spurious -EAGAIN errors can happen and the
17
request needs to be resubmitted.
18
19
The MAINTAINERS changes carry no risk and we might as well include them in QEMU
20
6.1.
17
21
18
----------------------------------------------------------------
22
----------------------------------------------------------------
19
23
20
Joe Perches (4):
24
Fabian Ebner (1):
21
checkpatch: add a --strict check for utf-8 in commit logs
25
block/io_uring: resubmit when result is -EAGAIN
22
checkpatch: ignore email headers better
23
checkpatch: emit a warning on file add/move/delete
24
checkpatch: reduce MAINTAINERS update message frequency
25
26
26
Pasi Savanainen (1):
27
Philippe Mathieu-Daudé (1):
27
checkpatch: check utf-8 content from a commit log when it's missing
28
MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver
28
from charset
29
29
30
Stefan Hajnoczi (3):
30
Stefano Garzarella (1):
31
blockjob: drop block_job_pause/resume_all()
31
MAINTAINERS: add Stefano Garzarella as io_uring reviewer
32
block/file-posix: implement bdrv_co_invalidate_cache() on Linux
33
block/file-posix: add x-check-page-cache=on|off option
34
32
35
qapi/block-core.json | 7 +-
33
MAINTAINERS | 2 ++
36
include/block/blockjob_int.h | 14 ----
34
block/io_uring.c | 16 +++++++++++++++-
37
block/file-posix.c | 146 ++++++++++++++++++++++++++++++++++-
35
2 files changed, 17 insertions(+), 1 deletion(-)
38
blockjob.c | 27 -------
39
scripts/checkpatch.pl | 56 +++++++++++++-
40
5 files changed, 202 insertions(+), 48 deletions(-)
41
36
42
--
37
--
43
2.17.0
38
2.31.1
44
39
45
diff view generated by jsdifflib
Deleted patch
1
Commit 8119334918e86f45877cfc139192d54f2449a239 ("block: Don't
2
block_job_pause_all() in bdrv_drain_all()") removed the only callers of
3
block_job_pause/resume_all().
4
1
5
Pausing and resuming now happens in child_job_drained_begin/end() so
6
it's no longer necessary to globally pause/resume jobs.
7
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
Reviewed-by: John Snow <jsnow@redhat.com>
10
Reviewed-by: Alberto Garcia <berto@igalia.com>
11
Message-id: 20180424085240.5798-1-stefanha@redhat.com
12
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
---
14
include/block/blockjob_int.h | 14 --------------
15
blockjob.c | 27 ---------------------------
16
2 files changed, 41 deletions(-)
17
18
diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/block/blockjob_int.h
21
+++ b/include/block/blockjob_int.h
22
@@ -XXX,XX +XXX,XX @@ void block_job_sleep_ns(BlockJob *job, int64_t ns);
23
*/
24
void block_job_yield(BlockJob *job);
25
26
-/**
27
- * block_job_pause_all:
28
- *
29
- * Asynchronously pause all jobs.
30
- */
31
-void block_job_pause_all(void);
32
-
33
-/**
34
- * block_job_resume_all:
35
- *
36
- * Resume all block jobs. Must be paired with a preceding block_job_pause_all.
37
- */
38
-void block_job_resume_all(void);
39
-
40
/**
41
* block_job_early_fail:
42
* @bs: The block device.
43
diff --git a/blockjob.c b/blockjob.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/blockjob.c
46
+++ b/blockjob.c
47
@@ -XXX,XX +XXX,XX @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
48
return job;
49
}
50
51
-void block_job_pause_all(void)
52
-{
53
- BlockJob *job = NULL;
54
- while ((job = block_job_next(job))) {
55
- AioContext *aio_context = blk_get_aio_context(job->blk);
56
-
57
- aio_context_acquire(aio_context);
58
- block_job_ref(job);
59
- block_job_pause(job);
60
- aio_context_release(aio_context);
61
- }
62
-}
63
-
64
void block_job_early_fail(BlockJob *job)
65
{
66
assert(job->status == BLOCK_JOB_STATUS_CREATED);
67
@@ -XXX,XX +XXX,XX @@ void coroutine_fn block_job_pause_point(BlockJob *job)
68
}
69
}
70
71
-void block_job_resume_all(void)
72
-{
73
- BlockJob *job, *next;
74
-
75
- QLIST_FOREACH_SAFE(job, &block_jobs, job_list, next) {
76
- AioContext *aio_context = blk_get_aio_context(job->blk);
77
-
78
- aio_context_acquire(aio_context);
79
- block_job_resume(job);
80
- block_job_unref(job);
81
- aio_context_release(aio_context);
82
- }
83
-}
84
-
85
/*
86
* Conditionally enter a block_job pending a call to fn() while
87
* under the block_job_lock critical section.
88
--
89
2.17.0
90
91
diff view generated by jsdifflib
Deleted patch
1
From: Joe Perches <joe@perches.com>
2
1
3
Some find using utf-8 in commit logs inappropriate.
4
5
Some patch commit logs contain unintended utf-8 characters when doing
6
things like copy/pasting compilation output.
7
8
Look for the start of any commit log by skipping initial lines that look
9
like email headers and "From: " lines.
10
11
Stop looking for utf-8 at the first signature line.
12
13
Signed-off-by: Joe Perches <joe@perches.com>
14
Reviewed-by: Markus Armbruster <armbru@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
18
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
19
Message-id: 20180430124651.10340-2-stefanha@redhat.com
20
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
21
Cc: Andy Whitcroft <apw@shadowen.org>
22
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
23
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24
(cherry picked from commit 15662b3e8644905032c2e26808401a487d4e90c1)
25
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
26
27
Conflicts:
28
QEMU does not have CHK(), use WARN() instead.
29
30
QEMU WARN() only takes one argument, drop the 'type' value in the
31
first argument.
32
33
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
34
---
35
scripts/checkpatch.pl | 30 ++++++++++++++++++++++++++----
36
1 file changed, 26 insertions(+), 4 deletions(-)
37
38
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
39
index XXXXXXX..XXXXXXX 100755
40
--- a/scripts/checkpatch.pl
41
+++ b/scripts/checkpatch.pl
42
@@ -XXX,XX +XXX,XX @@ our $NonptrType;
43
our $Type;
44
our $Declare;
45
46
-our $UTF8    = qr {
47
-    [\x09\x0A\x0D\x20-\x7E] # ASCII
48
-    | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
49
+our $NON_ASCII_UTF8    = qr{
50
+    [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
51
    | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
52
    | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
53
    | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
54
@@ -XXX,XX +XXX,XX @@ our $UTF8    = qr {
55
    | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
56
}x;
57
58
+our $UTF8    = qr{
59
+    [\x09\x0A\x0D\x20-\x7E] # ASCII
60
+    | $NON_ASCII_UTF8
61
+}x;
62
+
63
# There are still some false positives, but this catches most
64
# common cases.
65
our $typeTypedefs = qr{(?x:
66
@@ -XXX,XX +XXX,XX @@ sub process {
67
    my $signoff = 0;
68
    my $is_patch = 0;
69
70
+    my $in_header_lines = 1;
71
+    my $in_commit_log = 0;        #Scanning lines before patch
72
+
73
    our @report = ();
74
    our $cnt_lines = 0;
75
    our $cnt_error = 0;
76
@@ -XXX,XX +XXX,XX @@ sub process {
77
        if ($line =~ /^diff --git.*?(\S+)$/) {
78
            $realfile = $1;
79
            $realfile =~ s@^([^/]*)/@@;
80
-
81
        } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
82
            $realfile = $1;
83
            $realfile =~ s@^([^/]*)/@@;
84
@@ -XXX,XX +XXX,XX @@ sub process {
85
        if ($line =~ /^\s*signed-off-by:/i) {
86
            # This is a signoff, if ugly, so do not double report.
87
            $signoff++;
88
+            $in_commit_log = 0;
89
+
90
            if (!($line =~ /^\s*Signed-off-by:/)) {
91
                ERROR("The correct form is \"Signed-off-by\"\n" .
92
                    $herecurr);
93
@@ -XXX,XX +XXX,XX @@ sub process {
94
            ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
95
        }
96
97
+# Check if it's the start of a commit log
98
+# (not a header line and we haven't seen the patch filename)
99
+        if ($in_header_lines && $realfile =~ /^$/ &&
100
+         $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
101
+            $in_header_lines = 0;
102
+            $in_commit_log = 1;
103
+        }
104
+
105
+# Still not yet in a patch, check for any UTF-8
106
+        if ($in_commit_log && $realfile =~ /^$/ &&
107
+         $rawline =~ /$NON_ASCII_UTF8/) {
108
+            WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
109
+        }
110
+
111
# ignore non-hunk lines and lines being removed
112
        next if (!$hunk_line || $line =~ /^-/);
113
114
--
115
2.17.0
116
117
diff view generated by jsdifflib
Deleted patch
1
From: Pasi Savanainen <pasi.savanainen@nixu.com>
2
1
3
Check that a commit log doesn't contain UTF-8 when a mail header
4
explicitly defines a different charset, like
5
6
'Content-Type: text/plain; charset="us-ascii"'
7
8
Signed-off-by: Pasi Savanainen <pasi.savanainen@nixu.com>
9
Reviewed-by: Markus Armbruster <armbru@redhat.com>
10
Reviewed-by: Thomas Huth <thuth@redhat.com>
11
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
13
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14
Message-id: 20180430124651.10340-3-stefanha@redhat.com
15
Cc: Joe Perches <joe@perches.com>
16
Cc: Andy Whitcroft <apw@canonical.com>
17
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
18
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
19
(cherry picked from commit fa64205df9dfd7b7662cc64a7e82115c00e428e5)
20
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
21
Reviewed-by: Thomas Huth <thuth@redhat.com>
22
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
23
---
24
scripts/checkpatch.pl | 13 +++++++++++--
25
1 file changed, 11 insertions(+), 2 deletions(-)
26
27
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
28
index XXXXXXX..XXXXXXX 100755
29
--- a/scripts/checkpatch.pl
30
+++ b/scripts/checkpatch.pl
31
@@ -XXX,XX +XXX,XX @@ sub process {
32
    my $in_header_lines = 1;
33
    my $in_commit_log = 0;        #Scanning lines before patch
34
35
+    my $non_utf8_charset = 0;
36
+
37
    our @report = ();
38
    our $cnt_lines = 0;
39
    our $cnt_error = 0;
40
@@ -XXX,XX +XXX,XX @@ sub process {
41
            $in_commit_log = 1;
42
        }
43
44
-# Still not yet in a patch, check for any UTF-8
45
-        if ($in_commit_log && $realfile =~ /^$/ &&
46
+# Check if there is UTF-8 in a commit log when a mail header has explicitly
47
+# declined it, i.e defined some charset where it is missing.
48
+        if ($in_header_lines &&
49
+         $rawline =~ /^Content-Type:.+charset="(.+)".*$/ &&
50
+         $1 !~ /utf-8/i) {
51
+            $non_utf8_charset = 1;
52
+        }
53
+
54
+        if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
55
         $rawline =~ /$NON_ASCII_UTF8/) {
56
            WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
57
        }
58
--
59
2.17.0
60
61
diff view generated by jsdifflib
Deleted patch
1
From: Joe Perches <joe@perches.com>
2
1
3
There are some patches created by git format-patch that when scanned by
4
checkpatch report errors on lines like
5
6
To:    address.tld
7
8
This is a checkpatch false positive.
9
10
Improve the logic a bit to ignore folded email headers to avoid emitting
11
these messages.
12
13
Signed-off-by: Joe Perches <joe@perches.com>
14
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
15
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16
Reviewed-by: Markus Armbruster <armbru@redhat.com>
17
Reviewed-by: Thomas Huth <thuth@redhat.com>
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
Message-id: 20180430124651.10340-4-stefanha@redhat.com
20
(cherry picked from commit 29ee1b0c67e0dd7dea8dd718e8326076bce5b6fe)
21
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
22
Reviewed-by: Thomas Huth <thuth@redhat.com>
23
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
24
---
25
scripts/checkpatch.pl | 5 +++--
26
1 file changed, 3 insertions(+), 2 deletions(-)
27
28
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
29
index XXXXXXX..XXXXXXX 100755
30
--- a/scripts/checkpatch.pl
31
+++ b/scripts/checkpatch.pl
32
@@ -XXX,XX +XXX,XX @@ sub process {
33
    my $signoff = 0;
34
    my $is_patch = 0;
35
36
-    my $in_header_lines = 1;
37
+    my $in_header_lines = $file ? 0 : 1;
38
    my $in_commit_log = 0;        #Scanning lines before patch
39
40
    my $non_utf8_charset = 0;
41
@@ -XXX,XX +XXX,XX @@ sub process {
42
# Check if it's the start of a commit log
43
# (not a header line and we haven't seen the patch filename)
44
        if ($in_header_lines && $realfile =~ /^$/ &&
45
-         $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
46
+         !($rawline =~ /^\s+\S/ ||
47
+         $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
48
            $in_header_lines = 0;
49
            $in_commit_log = 1;
50
        }
51
--
52
2.17.0
53
54
diff view generated by jsdifflib
Deleted patch
1
From: Joe Perches <joe@perches.com>
2
1
3
Whenever files are added, moved, or deleted, the MAINTAINERS file
4
patterns can be out of sync or outdated.
5
6
To try to keep MAINTAINERS more up-to-date, add a one-time warning
7
whenever a patch does any of those.
8
9
Signed-off-by: Joe Perches <joe@perches.com>
10
Acked-by: Andy Whitcroft <apw@canonical.com>
11
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
12
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13
Reviewed-by: Markus Armbruster <armbru@redhat.com>
14
Reviewed-by: Thomas Huth <thuth@redhat.com>
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
16
Message-id: 20180430124651.10340-5-stefanha@redhat.com
17
(cherry picked from commit 13f1937ef33950b1112049972249e6191b82e6c9)
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
Reviewed-by: Thomas Huth <thuth@redhat.com>
20
21
Conflicts:
22
QEMU WARN() only takes one argument, drop the 'type' value in the
23
first argument.
24
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
25
---
26
scripts/checkpatch.pl | 12 +++++++++++-
27
1 file changed, 11 insertions(+), 1 deletion(-)
28
29
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
30
index XXXXXXX..XXXXXXX 100755
31
--- a/scripts/checkpatch.pl
32
+++ b/scripts/checkpatch.pl
33
@@ -XXX,XX +XXX,XX @@ sub process {
34
35
    my $in_header_lines = $file ? 0 : 1;
36
    my $in_commit_log = 0;        #Scanning lines before patch
37
-
38
+    my $reported_maintainer_file = 0;
39
    my $non_utf8_charset = 0;
40
41
    our @report = ();
42
@@ -XXX,XX +XXX,XX @@ sub process {
43
            }
44
        }
45
46
+# Check for added, moved or deleted files
47
+        if (!$reported_maintainer_file && !$in_commit_log &&
48
+         ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
49
+         $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
50
+         ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
51
+         (defined($1) || defined($2))))) {
52
+            $reported_maintainer_file = 1;
53
+            WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
54
+        }
55
+
56
# Check for wrappage within a valid hunk of the file
57
        if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
58
            ERROR("patch seems to be corrupt (line wrapped?)\n" .
59
--
60
2.17.0
61
62
diff view generated by jsdifflib
1
mincore(2) checks whether pages are resident. Use it to verify that
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
page cache has been dropped.
3
2
4
You can trigger a verification failure by mmapping the image file from
3
I've been working with io_uring for a while so I'd like to help
5
another process that loads a byte from a page, forcing it to become
4
with reviews.
6
resident. bdrv_co_invalidate_cache() will fail while that process is
7
alive.
8
5
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
10
Reviewed-by: Fam Zheng <famz@redhat.com>
7
Message-Id: <20210728131515.131045-1-sgarzare@redhat.com>
11
Message-id: 20180427162312.18583-3-stefanha@redhat.com
12
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
---
9
---
14
qapi/block-core.json | 7 ++-
10
MAINTAINERS | 1 +
15
block/file-posix.c | 100 ++++++++++++++++++++++++++++++++++++++++++-
11
1 file changed, 1 insertion(+)
16
2 files changed, 104 insertions(+), 3 deletions(-)
17
12
18
diff --git a/qapi/block-core.json b/qapi/block-core.json
13
diff --git a/MAINTAINERS b/MAINTAINERS
19
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
20
--- a/qapi/block-core.json
15
--- a/MAINTAINERS
21
+++ b/qapi/block-core.json
16
+++ b/MAINTAINERS
22
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ Linux io_uring
23
# @locking: whether to enable file locking. If set to 'auto', only enable
18
M: Aarushi Mehta <mehta.aaru20@gmail.com>
24
# when Open File Descriptor (OFD) locking API is available
19
M: Julia Suvorova <jusual@redhat.com>
25
# (default: auto, since 2.10)
20
M: Stefan Hajnoczi <stefanha@redhat.com>
26
+# @x-check-cache-dropped: whether to check that page cache was dropped on live
21
+R: Stefano Garzarella <sgarzare@redhat.com>
27
+# migration. May cause noticeable delays if the image
22
L: qemu-block@nongnu.org
28
+# file is large, do not use in production.
23
S: Maintained
29
+# (default: off) (since: 2.13)
24
F: block/io_uring.c
30
#
31
# Since: 2.9
32
##
33
@@ -XXX,XX +XXX,XX @@
34
'data': { 'filename': 'str',
35
'*pr-manager': 'str',
36
'*locking': 'OnOffAuto',
37
- '*aio': 'BlockdevAioOptions' } }
38
+ '*aio': 'BlockdevAioOptions',
39
+ '*x-check-cache-dropped': 'bool' } }
40
41
##
42
# @BlockdevOptionsNull:
43
diff --git a/block/file-posix.c b/block/file-posix.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/block/file-posix.c
46
+++ b/block/file-posix.c
47
@@ -XXX,XX +XXX,XX @@ typedef struct BDRVRawState {
48
bool page_cache_inconsistent:1;
49
bool has_fallocate;
50
bool needs_alignment;
51
+ bool check_cache_dropped;
52
53
PRManager *pr_mgr;
54
} BDRVRawState;
55
@@ -XXX,XX +XXX,XX @@ typedef struct BDRVRawState {
56
typedef struct BDRVRawReopenState {
57
int fd;
58
int open_flags;
59
+ bool check_cache_dropped;
60
} BDRVRawReopenState;
61
62
static int fd_open(BlockDriverState *bs);
63
@@ -XXX,XX +XXX,XX @@ static QemuOptsList raw_runtime_opts = {
64
.type = QEMU_OPT_STRING,
65
.help = "id of persistent reservation manager object (default: none)",
66
},
67
+ {
68
+ .name = "x-check-cache-dropped",
69
+ .type = QEMU_OPT_BOOL,
70
+ .help = "check that page cache was dropped on live migration (default: off)"
71
+ },
72
{ /* end of list */ }
73
},
74
};
75
@@ -XXX,XX +XXX,XX @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
76
}
77
}
78
79
+ s->check_cache_dropped = qemu_opt_get_bool(opts, "x-check-cache-dropped",
80
+ false);
81
+
82
s->open_flags = open_flags;
83
raw_parse_flags(bdrv_flags, &s->open_flags);
84
85
@@ -XXX,XX +XXX,XX @@ static int raw_reopen_prepare(BDRVReopenState *state,
86
{
87
BDRVRawState *s;
88
BDRVRawReopenState *rs;
89
+ QemuOpts *opts;
90
int ret = 0;
91
Error *local_err = NULL;
92
93
@@ -XXX,XX +XXX,XX @@ static int raw_reopen_prepare(BDRVReopenState *state,
94
95
state->opaque = g_new0(BDRVRawReopenState, 1);
96
rs = state->opaque;
97
+ rs->fd = -1;
98
+
99
+ /* Handle options changes */
100
+ opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
101
+ qemu_opts_absorb_qdict(opts, state->options, &local_err);
102
+ if (local_err) {
103
+ error_propagate(errp, local_err);
104
+ ret = -EINVAL;
105
+ goto out;
106
+ }
107
+
108
+ rs->check_cache_dropped = qemu_opt_get_bool(opts, "x-check-cache-dropped",
109
+ s->check_cache_dropped);
110
111
if (s->type == FTYPE_CD) {
112
rs->open_flags |= O_NONBLOCK;
113
@@ -XXX,XX +XXX,XX @@ static int raw_reopen_prepare(BDRVReopenState *state,
114
115
raw_parse_flags(state->flags, &rs->open_flags);
116
117
- rs->fd = -1;
118
-
119
int fcntl_flags = O_APPEND | O_NONBLOCK;
120
#ifdef O_NOATIME
121
fcntl_flags |= O_NOATIME;
122
@@ -XXX,XX +XXX,XX @@ static int raw_reopen_prepare(BDRVReopenState *state,
123
}
124
}
125
126
+out:
127
+ qemu_opts_del(opts);
128
return ret;
129
}
130
131
@@ -XXX,XX +XXX,XX @@ static void raw_reopen_commit(BDRVReopenState *state)
132
BDRVRawReopenState *rs = state->opaque;
133
BDRVRawState *s = state->bs->opaque;
134
135
+ s->check_cache_dropped = rs->check_cache_dropped;
136
s->open_flags = rs->open_flags;
137
138
qemu_close(s->fd);
139
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs,
140
return ret | BDRV_BLOCK_OFFSET_VALID;
141
}
142
143
+#if defined(__linux__)
144
+/* Verify that the file is not in the page cache */
145
+static void check_cache_dropped(BlockDriverState *bs, Error **errp)
146
+{
147
+ const size_t window_size = 128 * 1024 * 1024;
148
+ BDRVRawState *s = bs->opaque;
149
+ void *window = NULL;
150
+ size_t length = 0;
151
+ unsigned char *vec;
152
+ size_t page_size;
153
+ off_t offset;
154
+ off_t end;
155
+
156
+ /* mincore(2) page status information requires 1 byte per page */
157
+ page_size = sysconf(_SC_PAGESIZE);
158
+ vec = g_malloc(DIV_ROUND_UP(window_size, page_size));
159
+
160
+ end = raw_getlength(bs);
161
+
162
+ for (offset = 0; offset < end; offset += window_size) {
163
+ void *new_window;
164
+ size_t new_length;
165
+ size_t vec_end;
166
+ size_t i;
167
+ int ret;
168
+
169
+ /* Unmap previous window if size has changed */
170
+ new_length = MIN(end - offset, window_size);
171
+ if (new_length != length) {
172
+ munmap(window, length);
173
+ window = NULL;
174
+ length = 0;
175
+ }
176
+
177
+ new_window = mmap(window, new_length, PROT_NONE, MAP_PRIVATE,
178
+ s->fd, offset);
179
+ if (new_window == MAP_FAILED) {
180
+ error_setg_errno(errp, errno, "mmap failed");
181
+ break;
182
+ }
183
+
184
+ window = new_window;
185
+ length = new_length;
186
+
187
+ ret = mincore(window, length, vec);
188
+ if (ret < 0) {
189
+ error_setg_errno(errp, errno, "mincore failed");
190
+ break;
191
+ }
192
+
193
+ vec_end = DIV_ROUND_UP(length, page_size);
194
+ for (i = 0; i < vec_end; i++) {
195
+ if (vec[i] & 0x1) {
196
+ error_setg(errp, "page cache still in use!");
197
+ break;
198
+ }
199
+ }
200
+ }
201
+
202
+ if (window) {
203
+ munmap(window, length);
204
+ }
205
+
206
+ g_free(vec);
207
+}
208
+#endif /* __linux__ */
209
+
210
static void coroutine_fn raw_co_invalidate_cache(BlockDriverState *bs,
211
Error **errp)
212
{
213
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn raw_co_invalidate_cache(BlockDriverState *bs,
214
error_setg_errno(errp, ret, "fadvise failed");
215
return;
216
}
217
+
218
+ if (s->check_cache_dropped) {
219
+ check_cache_dropped(bs, errp);
220
+ }
221
#else /* __linux__ */
222
/* Do nothing. Live migration to a remote host with cache.direct=off is
223
* unsupported on other host operating systems. Cache consistency issues
224
--
25
--
225
2.17.0
26
2.31.1
226
27
227
diff view generated by jsdifflib
1
On Linux posix_fadvise(POSIX_FADV_DONTNEED) invalidates pages*. Use
1
From: Fabian Ebner <f.ebner@proxmox.com>
2
this to drop page cache on the destination host during shared storage
3
migration. This way the destination host will read the latest copy of
4
the data and will not use stale data from the page cache.
5
2
6
The flow is as follows:
3
Linux SCSI can throw spurious -EAGAIN in some corner cases in its
4
completion path, which will end up being the result in the completed
5
io_uring request.
7
6
8
1. Source host writes out all dirty pages and inactivates drives.
7
Resubmitting such requests should allow block jobs to complete, even
9
2. QEMU_VM_EOF is sent on migration stream.
8
if such spurious errors are encountered.
10
3. Destination host invalidates caches before accessing drives.
11
9
12
This patch enables live migration even with -drive cache.direct=off.
10
Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com>
13
11
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
14
* Terms and conditions may apply, please see patch for details.
12
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
15
13
Message-id: 20210729091029.65369-1-f.ebner@proxmox.com
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Reviewed-by: Fam Zheng <famz@redhat.com>
18
Message-id: 20180427162312.18583-2-stefanha@redhat.com
19
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20
---
15
---
21
block/file-posix.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
16
block/io_uring.c | 16 +++++++++++++++-
22
1 file changed, 46 insertions(+)
17
1 file changed, 15 insertions(+), 1 deletion(-)
23
18
24
diff --git a/block/file-posix.c b/block/file-posix.c
19
diff --git a/block/io_uring.c b/block/io_uring.c
25
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
26
--- a/block/file-posix.c
21
--- a/block/io_uring.c
27
+++ b/block/file-posix.c
22
+++ b/block/io_uring.c
28
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs,
23
@@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s)
29
return ret | BDRV_BLOCK_OFFSET_VALID;
24
total_bytes = ret + luringcb->total_read;
30
}
25
31
26
if (ret < 0) {
32
+static void coroutine_fn raw_co_invalidate_cache(BlockDriverState *bs,
27
- if (ret == -EINTR) {
33
+ Error **errp)
28
+ /*
34
+{
29
+ * Only writev/readv/fsync requests on regular files or host block
35
+ BDRVRawState *s = bs->opaque;
30
+ * devices are submitted. Therefore -EAGAIN is not expected but it's
36
+ int ret;
31
+ * known to happen sometimes with Linux SCSI. Submit again and hope
37
+
32
+ * the request completes successfully.
38
+ ret = fd_open(bs);
33
+ *
39
+ if (ret < 0) {
34
+ * For more information, see:
40
+ error_setg_errno(errp, -ret, "The file descriptor is not open");
35
+ * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u
41
+ return;
36
+ *
42
+ }
37
+ * If the code is changed to submit other types of requests in the
43
+
38
+ * future, then this workaround may need to be extended to deal with
44
+ if (s->open_flags & O_DIRECT) {
39
+ * genuine -EAGAIN results that should not be resubmitted
45
+ return; /* No host kernel page cache */
40
+ * immediately.
46
+ }
41
+ */
47
+
42
+ if (ret == -EINTR || ret == -EAGAIN) {
48
+#if defined(__linux__)
43
luring_resubmit(s, luringcb);
49
+ /* This sets the scene for the next syscall... */
44
continue;
50
+ ret = bdrv_co_flush(bs);
45
}
51
+ if (ret < 0) {
52
+ error_setg_errno(errp, -ret, "flush failed");
53
+ return;
54
+ }
55
+
56
+ /* Linux does not invalidate pages that are dirty, locked, or mmapped by a
57
+ * process. These limitations are okay because we just fsynced the file,
58
+ * we don't use mmap, and the file should not be in use by other processes.
59
+ */
60
+ ret = posix_fadvise(s->fd, 0, 0, POSIX_FADV_DONTNEED);
61
+ if (ret != 0) { /* the return value is a positive errno */
62
+ error_setg_errno(errp, ret, "fadvise failed");
63
+ return;
64
+ }
65
+#else /* __linux__ */
66
+ /* Do nothing. Live migration to a remote host with cache.direct=off is
67
+ * unsupported on other host operating systems. Cache consistency issues
68
+ * may occur but no error is reported here, partly because that's the
69
+ * historical behavior and partly because it's hard to differentiate valid
70
+ * configurations that should not cause errors.
71
+ */
72
+#endif /* !__linux__ */
73
+}
74
+
75
static coroutine_fn BlockAIOCB *raw_aio_pdiscard(BlockDriverState *bs,
76
int64_t offset, int bytes,
77
BlockCompletionFunc *cb, void *opaque)
78
@@ -XXX,XX +XXX,XX @@ BlockDriver bdrv_file = {
79
.bdrv_co_create_opts = raw_co_create_opts,
80
.bdrv_has_zero_init = bdrv_has_zero_init_1,
81
.bdrv_co_block_status = raw_co_block_status,
82
+ .bdrv_co_invalidate_cache = raw_co_invalidate_cache,
83
.bdrv_co_pwrite_zeroes = raw_co_pwrite_zeroes,
84
85
.bdrv_co_preadv = raw_co_preadv,
86
@@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_host_device = {
87
.bdrv_reopen_abort = raw_reopen_abort,
88
.bdrv_co_create_opts = hdev_co_create_opts,
89
.create_opts = &raw_create_opts,
90
+ .bdrv_co_invalidate_cache = raw_co_invalidate_cache,
91
.bdrv_co_pwrite_zeroes = hdev_co_pwrite_zeroes,
92
93
.bdrv_co_preadv = raw_co_preadv,
94
@@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_host_cdrom = {
95
.bdrv_reopen_abort = raw_reopen_abort,
96
.bdrv_co_create_opts = hdev_co_create_opts,
97
.create_opts = &raw_create_opts,
98
+ .bdrv_co_invalidate_cache = raw_co_invalidate_cache,
99
100
101
.bdrv_co_preadv = raw_co_preadv,
102
--
46
--
103
2.17.0
47
2.31.1
104
48
105
diff view generated by jsdifflib
1
From: Joe Perches <joe@perches.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
When files are being added/moved/deleted and a patch contains an update to
3
I'm interested in following the activity around the NVMe bdrv.
4
the MAINTAINERS file, assume it's to update the MAINTAINERS file correctly
5
and do not emit the "does MAINTAINERS need updating?" message.
6
4
7
Reported by many people.
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
6
Message-id: 20210728183340.2018313-1-philmd@redhat.com
9
Signed-off-by: Joe Perches <joe@perches.com>
10
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12
Reviewed-by: Markus Armbruster <armbru@redhat.com>
13
Reviewed-by: Thomas Huth <thuth@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Message-id: 20180430124651.10340-6-stefanha@redhat.com
16
(cherry picked from e0d975b1b439c4fef58fbc306c542c94f48bb849)
17
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
18
Reviewed-by: Thomas Huth <thuth@redhat.com>
19
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20
---
8
---
21
scripts/checkpatch.pl | 6 ++++++
9
MAINTAINERS | 1 +
22
1 file changed, 6 insertions(+)
10
1 file changed, 1 insertion(+)
23
11
24
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
12
diff --git a/MAINTAINERS b/MAINTAINERS
25
index XXXXXXX..XXXXXXX 100755
13
index XXXXXXX..XXXXXXX 100644
26
--- a/scripts/checkpatch.pl
14
--- a/MAINTAINERS
27
+++ b/scripts/checkpatch.pl
15
+++ b/MAINTAINERS
28
@@ -XXX,XX +XXX,XX @@ sub process {
16
@@ -XXX,XX +XXX,XX @@ F: block/null.c
29
            }
17
NVMe Block Driver
30
        }
18
M: Stefan Hajnoczi <stefanha@redhat.com>
31
19
R: Fam Zheng <fam@euphon.net>
32
+# Check if MAINTAINERS is being updated. If so, there's probably no need to
20
+R: Philippe Mathieu-Daudé <philmd@redhat.com>
33
+# emit the "does MAINTAINERS need updating?" message on file add/move/delete
21
L: qemu-block@nongnu.org
34
+        if ($line =~ /^\s*MAINTAINERS\s*\|/) {
22
S: Supported
35
+            $reported_maintainer_file = 1;
23
F: block/nvme*
36
+        }
37
+
38
# Check for added, moved or deleted files
39
        if (!$reported_maintainer_file && !$in_commit_log &&
40
         ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
41
--
24
--
42
2.17.0
25
2.31.1
43
26
44
diff view generated by jsdifflib