All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-blkfront: feature flags handling adjustments
@ 2017-01-23 15:12 Jan Beulich
  2017-01-24 10:55 ` Roger Pau Monne
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2017-01-23 15:12 UTC (permalink / raw)
  To: Roger Pau Monne, Konrad Rzeszutek Wilk; +Cc: xen-devel

Don't truncate the "feature-persistent" value read from xenstore: Any
non-zero value is supposed to enable the feature, just like is already
being done for feature_secdiscard.

Just like the other feature_* fields, feature_flush and feature_fua are
boolean flags, and hence fit well into a single bit.

Keep all bit fields together to limit gaps.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 drivers/block/xen-blkfront.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- 4.10-rc5/drivers/block/xen-blkfront.c
+++ 4.10-rc5-xen-blkfront-feature-flags/drivers/block/xen-blkfront.c
@@ -197,13 +197,13 @@ struct blkfront_info
 	/* Number of pages per ring buffer. */
 	unsigned int nr_ring_pages;
 	struct request_queue *rq;
-	unsigned int feature_flush;
-	unsigned int feature_fua;
+	unsigned int feature_flush:1;
+	unsigned int feature_fua:1;
 	unsigned int feature_discard:1;
 	unsigned int feature_secdiscard:1;
+	unsigned int feature_persistent:1;
 	unsigned int discard_granularity;
 	unsigned int discard_alignment;
-	unsigned int feature_persistent:1;
 	/* Number of 4KB segments handled */
 	unsigned int max_indirect_segments;
 	int is_ready;
@@ -2323,8 +2323,8 @@ static void blkfront_gather_backend_feat
 		blkfront_setup_discard(info);
 
 	info->feature_persistent =
-		xenbus_read_unsigned(info->xbdev->otherend,
-				     "feature-persistent", 0);
+		!!xenbus_read_unsigned(info->xbdev->otherend,
+				       "feature-persistent", 0);
 
 	indirect_segments = xenbus_read_unsigned(info->xbdev->otherend,
 					"feature-max-indirect-segments", 0);




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xen-blkfront: feature flags handling adjustments
  2017-01-23 15:12 [PATCH] xen-blkfront: feature flags handling adjustments Jan Beulich
@ 2017-01-24 10:55 ` Roger Pau Monne
  0 siblings, 0 replies; 2+ messages in thread
From: Roger Pau Monne @ 2017-01-24 10:55 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

On Mon, Jan 23, 2017 at 08:12:19AM -0700, Jan Beulich wrote:
> Don't truncate the "feature-persistent" value read from xenstore: Any
> non-zero value is supposed to enable the feature, just like is already
> being done for feature_secdiscard.
> 
> Just like the other feature_* fields, feature_flush and feature_fua are
> boolean flags, and hence fit well into a single bit.
> 
> Keep all bit fields together to limit gaps.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-24 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 15:12 [PATCH] xen-blkfront: feature flags handling adjustments Jan Beulich
2017-01-24 10:55 ` Roger Pau Monne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.