Message ID | 1463494315-12578-3-git-send-email-pl@kamp.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, May 17, 2016 at 04:11:55PM +0200, Peter Lieven wrote: > Signed-off-by: Peter Lieven <pl@kamp.de> > --- > block/nfs.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/block/nfs.c b/block/nfs.c > index 975510f..8b73a35 100644 > --- a/block/nfs.c > +++ b/block/nfs.c > @@ -331,6 +331,11 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename, > nfs_set_tcp_syncnt(client->context, val); > #ifdef LIBNFS_FEATURE_READAHEAD > } else if (!strcmp(qp->p[i].name, "readahead")) { > + if (open_flags & BDRV_O_NOCACHE) { > + error_setg(errp, "Cannot enable NFS readahead " > + "if cache.direct = on"); > + goto fail; > + } > if (val > QEMU_NFS_MAX_READAHEAD_SIZE) { > error_report("NFS Warning: Truncating NFS readahead" > " size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); > -- > 1.9.1 > Do we to check for cache mode changes now in nfs_reopen_prepare()?
Am 18.05.2016 um 15:28 schrieb Jeff Cody: > On Tue, May 17, 2016 at 04:11:55PM +0200, Peter Lieven wrote: >> Signed-off-by: Peter Lieven <pl@kamp.de> >> --- >> block/nfs.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/block/nfs.c b/block/nfs.c >> index 975510f..8b73a35 100644 >> --- a/block/nfs.c >> +++ b/block/nfs.c >> @@ -331,6 +331,11 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename, >> nfs_set_tcp_syncnt(client->context, val); >> #ifdef LIBNFS_FEATURE_READAHEAD >> } else if (!strcmp(qp->p[i].name, "readahead")) { >> + if (open_flags & BDRV_O_NOCACHE) { >> + error_setg(errp, "Cannot enable NFS readahead " >> + "if cache.direct = on"); >> + goto fail; >> + } >> if (val > QEMU_NFS_MAX_READAHEAD_SIZE) { >> error_report("NFS Warning: Truncating NFS readahead" >> " size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); >> -- >> 1.9.1 >> > Do we to check for cache mode changes now in nfs_reopen_prepare()? Good point. I guess I have to error out in bdrv_reopen_prepare if we change the cache.direct from off to on and have readahead or pagecache enabled. Will send an update. Thanks, Peter
diff --git a/block/nfs.c b/block/nfs.c index 975510f..8b73a35 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -331,6 +331,11 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename, nfs_set_tcp_syncnt(client->context, val); #ifdef LIBNFS_FEATURE_READAHEAD } else if (!strcmp(qp->p[i].name, "readahead")) { + if (open_flags & BDRV_O_NOCACHE) { + error_setg(errp, "Cannot enable NFS readahead " + "if cache.direct = on"); + goto fail; + } if (val > QEMU_NFS_MAX_READAHEAD_SIZE) { error_report("NFS Warning: Truncating NFS readahead" " size to %d", QEMU_NFS_MAX_READAHEAD_SIZE);
Signed-off-by: Peter Lieven <pl@kamp.de> --- block/nfs.c | 5 +++++ 1 file changed, 5 insertions(+)