|
@@ -1635,36 +1635,24 @@ blkfront_closing(struct blkfront_info *info)
|
|
static void blkfront_setup_discard(struct blkfront_info *info)
|
|
static void blkfront_setup_discard(struct blkfront_info *info)
|
|
{
|
|
{
|
|
int err;
|
|
int err;
|
|
- char *type;
|
|
|
|
unsigned int discard_granularity;
|
|
unsigned int discard_granularity;
|
|
unsigned int discard_alignment;
|
|
unsigned int discard_alignment;
|
|
unsigned int discard_secure;
|
|
unsigned int discard_secure;
|
|
|
|
|
|
- type = xenbus_read(XBT_NIL, info->xbdev->otherend, "type", NULL);
|
|
|
|
- if (IS_ERR(type))
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- info->feature_secdiscard = 0;
|
|
|
|
- if (strncmp(type, "phy", 3) == 0) {
|
|
|
|
- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
|
|
|
|
- "discard-granularity", "%u", &discard_granularity,
|
|
|
|
- "discard-alignment", "%u", &discard_alignment,
|
|
|
|
- NULL);
|
|
|
|
- if (!err) {
|
|
|
|
- info->feature_discard = 1;
|
|
|
|
- info->discard_granularity = discard_granularity;
|
|
|
|
- info->discard_alignment = discard_alignment;
|
|
|
|
- }
|
|
|
|
- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
|
|
|
|
- "discard-secure", "%d", &discard_secure,
|
|
|
|
- NULL);
|
|
|
|
- if (!err)
|
|
|
|
- info->feature_secdiscard = discard_secure;
|
|
|
|
-
|
|
|
|
- } else if (strncmp(type, "file", 4) == 0)
|
|
|
|
- info->feature_discard = 1;
|
|
|
|
-
|
|
|
|
- kfree(type);
|
|
|
|
|
|
+ info->feature_discard = 1;
|
|
|
|
+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
|
|
|
|
+ "discard-granularity", "%u", &discard_granularity,
|
|
|
|
+ "discard-alignment", "%u", &discard_alignment,
|
|
|
|
+ NULL);
|
|
|
|
+ if (!err) {
|
|
|
|
+ info->discard_granularity = discard_granularity;
|
|
|
|
+ info->discard_alignment = discard_alignment;
|
|
|
|
+ }
|
|
|
|
+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
|
|
|
|
+ "discard-secure", "%d", &discard_secure,
|
|
|
|
+ NULL);
|
|
|
|
+ if (!err)
|
|
|
|
+ info->feature_secdiscard = !!discard_secure;
|
|
}
|
|
}
|
|
|
|
|
|
static int blkfront_setup_indirect(struct blkfront_info *info)
|
|
static int blkfront_setup_indirect(struct blkfront_info *info)
|