Message ID | 1297247521-11464-4-git-send-email-kwolf@redhat.com |
---|---|
State | New |
Headers | show |
On 02/09/2011 04:32 AM, Kevin Wolf wrote: > Instead of just returning -ENOTSUP, generate a more detailed error. > > Unfortunately we don't have a helpful text for features that we don't know yet, > so just print the feature mask. It might be useful at least if someone asks for > help. > > Signed-off-by: Kevin Wolf<kwolf@redhat.com> > We can use a compatible feature to create a feature name table. > --- > block/qed.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/block/qed.c b/block/qed.c > index 3273448..8b0a975 100644 > --- a/block/qed.c > +++ b/block/qed.c > @@ -14,6 +14,7 @@ > > #include "trace.h" > #include "qed.h" > +#include "qerror.h" > > static void qed_aio_cancel(BlockDriverAIOCB *blockacb) > { > @@ -311,7 +312,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) > return -EINVAL; > } > if (s->header.features& ~QED_FEATURE_MASK) { > - return -ENOTSUP; /* image uses unsupported feature bits */ > + /* image uses unsupported feature bits */ > + char version[64]; > + snprintf(version, sizeof(version), "%" PRIx64, s->header.features); > It would be useful to do s->header.features & QED_FEATURE_MASK here as a management tool doesn't know what features this version of QED supports. Regards, Anthony Liguori > + qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, > + bs->device_name, version); > + return -ENOTSUP; > } > if (!qed_is_cluster_size_valid(s->header.cluster_size)) { > return -EINVAL; >
On 02/09/2011 04:32 AM, Kevin Wolf wrote: > Instead of just returning -ENOTSUP, generate a more detailed error. > > Unfortunately we don't have a helpful text for features that we don't know yet, > so just print the feature mask. It might be useful at least if someone asks for > help. > > Signed-off-by: Kevin Wolf<kwolf@redhat.com> > We can use a compatible feature to create a feature name table. > --- > block/qed.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/block/qed.c b/block/qed.c > index 3273448..8b0a975 100644 > --- a/block/qed.c > +++ b/block/qed.c > @@ -14,6 +14,7 @@ > > #include "trace.h" > #include "qed.h" > +#include "qerror.h" > > static void qed_aio_cancel(BlockDriverAIOCB *blockacb) > { > @@ -311,7 +312,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) > return -EINVAL; > } > if (s->header.features& ~QED_FEATURE_MASK) { > - return -ENOTSUP; /* image uses unsupported feature bits */ > + /* image uses unsupported feature bits */ > + char version[64]; > + snprintf(version, sizeof(version), "%" PRIx64, s->header.features); > It would be useful to do s->header.features & QED_FEATURE_MASK here as a management tool doesn't know what features this version of QED supports. Regards, Anthony Liguori > + qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, > + bs->device_name, version); > + return -ENOTSUP; > } > if (!qed_is_cluster_size_valid(s->header.cluster_size)) { > return -EINVAL; >
Am 09.02.2011 12:21, schrieb Anthony Liguori: > On 02/09/2011 04:32 AM, Kevin Wolf wrote: >> Instead of just returning -ENOTSUP, generate a more detailed error. >> >> Unfortunately we don't have a helpful text for features that we don't know yet, >> so just print the feature mask. It might be useful at least if someone asks for >> help. >> >> Signed-off-by: Kevin Wolf<kwolf@redhat.com> >> > > We can use a compatible feature to create a feature name table. If you want to introduce something like this in a 0.14-rc2...? I'm not going to write the code, but if someone sends a patch, we can consider it. >> --- >> block/qed.c | 8 +++++++- >> 1 files changed, 7 insertions(+), 1 deletions(-) >> >> diff --git a/block/qed.c b/block/qed.c >> index 3273448..8b0a975 100644 >> --- a/block/qed.c >> +++ b/block/qed.c >> @@ -14,6 +14,7 @@ >> >> #include "trace.h" >> #include "qed.h" >> +#include "qerror.h" >> >> static void qed_aio_cancel(BlockDriverAIOCB *blockacb) >> { >> @@ -311,7 +312,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) >> return -EINVAL; >> } >> if (s->header.features& ~QED_FEATURE_MASK) { >> - return -ENOTSUP; /* image uses unsupported feature bits */ >> + /* image uses unsupported feature bits */ >> + char version[64]; >> + snprintf(version, sizeof(version), "%" PRIx64, s->header.features); >> > > It would be useful to do s->header.features & QED_FEATURE_MASK here as a > management tool doesn't know what features this version of QED supports. Makes sense. I'll change this for v2. Kevin
On 02/09/2011 05:29 AM, Kevin Wolf wrote: > Am 09.02.2011 12:21, schrieb Anthony Liguori: > >> On 02/09/2011 04:32 AM, Kevin Wolf wrote: >> >>> Instead of just returning -ENOTSUP, generate a more detailed error. >>> >>> Unfortunately we don't have a helpful text for features that we don't know yet, >>> so just print the feature mask. It might be useful at least if someone asks for >>> help. >>> >>> Signed-off-by: Kevin Wolf<kwolf@redhat.com> >>> >>> >> We can use a compatible feature to create a feature name table. >> > If you want to introduce something like this in a 0.14-rc2...? I'm not > going to write the code, but if someone sends a patch, we can consider it. > Not for 0.14-rc2 but for 0.15.0. Was just mentioning it as an idea. Regards, Anthony Liguori > >>> --- >>> block/qed.c | 8 +++++++- >>> 1 files changed, 7 insertions(+), 1 deletions(-) >>> >>> diff --git a/block/qed.c b/block/qed.c >>> index 3273448..8b0a975 100644 >>> --- a/block/qed.c >>> +++ b/block/qed.c >>> @@ -14,6 +14,7 @@ >>> >>> #include "trace.h" >>> #include "qed.h" >>> +#include "qerror.h" >>> >>> static void qed_aio_cancel(BlockDriverAIOCB *blockacb) >>> { >>> @@ -311,7 +312,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) >>> return -EINVAL; >>> } >>> if (s->header.features& ~QED_FEATURE_MASK) { >>> - return -ENOTSUP; /* image uses unsupported feature bits */ >>> + /* image uses unsupported feature bits */ >>> + char version[64]; >>> + snprintf(version, sizeof(version), "%" PRIx64, s->header.features); >>> >>> >> It would be useful to do s->header.features& QED_FEATURE_MASK here as a >> management tool doesn't know what features this version of QED supports. >> > Makes sense. I'll change this for v2. > > Kevin >
Am 09.02.2011 12:21, schrieb Anthony Liguori: > On 02/09/2011 04:32 AM, Kevin Wolf wrote: >> @@ -311,7 +312,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) >> return -EINVAL; >> } >> if (s->header.features& ~QED_FEATURE_MASK) { >> - return -ENOTSUP; /* image uses unsupported feature bits */ >> + /* image uses unsupported feature bits */ >> + char version[64]; >> + snprintf(version, sizeof(version), "%" PRIx64, s->header.features); >> > > It would be useful to do s->header.features & QED_FEATURE_MASK here as a > management tool doesn't know what features this version of QED supports. I think you mean s->header.features & ~QED_FEATURE_MASK (small, but important difference :-)) Kevin
diff --git a/block/qed.c b/block/qed.c index 3273448..8b0a975 100644 --- a/block/qed.c +++ b/block/qed.c @@ -14,6 +14,7 @@ #include "trace.h" #include "qed.h" +#include "qerror.h" static void qed_aio_cancel(BlockDriverAIOCB *blockacb) { @@ -311,7 +312,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) return -EINVAL; } if (s->header.features & ~QED_FEATURE_MASK) { - return -ENOTSUP; /* image uses unsupported feature bits */ + /* image uses unsupported feature bits */ + char version[64]; + snprintf(version, sizeof(version), "%" PRIx64, s->header.features); + qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bs->device_name, version); + return -ENOTSUP; } if (!qed_is_cluster_size_valid(s->header.cluster_size)) { return -EINVAL;
Instead of just returning -ENOTSUP, generate a more detailed error. Unfortunately we don't have a helpful text for features that we don't know yet, so just print the feature mask. It might be useful at least if someone asks for help. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- block/qed.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)