qdisk vs. file as vbd type
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"? Would the guest really care about that detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.
I wonder if that guest-visible change was well thought.
Olaf
Quoted 2 lines · Olaf Hering
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"?
Because qdisk is the backend instead of loop+blk (==file) I think this just happens naturally.
Quoted 3 lines
Would the guest really care about that
detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.
That sounds entirely bogus, it should be checking for some sort of feature-discard.
Quoted 8 lines
I wonder if that guest-visible change was well thought.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Olaf Hering
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"?
Because qdisk is the backend instead of loop+blk (==file) I think this just happens naturally.
Quoted 6 lines
Quoted 3 lines
Would the guest really care about that
detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.That sounds entirely bogus, it should be checking for some sort of feature-discard.
It does that, then calls blkfront_setup_discard which in turn knows just about phy and file. And I wonder why it does that.
Maybe this function should be simplified to assume that if its called feature_discard can be enabled. And if both discard-granularity/discard-alignment exist those properties should be assigned, similar for discard-secure.
Now that I look at the history of blkfront_setup_discard:
Li, Konrad, why does that function care at all about the 'type'? Shouldnt that check be removed?
Olaf
Quoted 23 lines · Olaf Hering
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Olaf Hering
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"?
Because qdisk is the backend instead of loop+blk (==file) I think this just happens naturally.
Quoted 6 lines
Quoted 3 lines
Would the guest really care about that
detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.That sounds entirely bogus, it should be checking for some sort of feature-discard.
It does that, then calls
blkfront_setup_discardwhich in turn knows just about phy and file. And I wonder why it does that.
Maybe this function should be simplified to assume that if its calledfeature_discardcan be enabled. And if both discard-granularity/discard-alignment exist those properties should be assigned, similar for discard-secure.
Quoted 4 lines
Now that I look at the history of
blkfront_setup_discard:Li, Konrad, why does that function care at all about the 'type'? Shouldnt that check be removed?
You are looking at:
ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1664) } else if (strncmp(type, "file", 4) == 0) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1665) info->feature_discard = 1; ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1666) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1667) kfree(type); ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1668)} ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1669)
My recollection is that at the time the patches were developed, loop was not able to do discard operations. That has since changed and loop can do it. Hence the force of =1 was added in.
But that assumes that 'file' is going through the 'loop' device.
If that assumption is incorrect then this needs to be fixed and perhaps the underlaying device ('file'?) interogated as to whether it can do discard or not.
Quoted 2 lines
Olaf
[ removing Li who is no longer with Novell ]
Quoted 11 lines · Konrad Rzeszutek Wilk
You are looking at:
ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1664) } else if (strncmp(type, "file", 4) == 0) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1665) info->feature_discard = 1; ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1666) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1667) kfree(type); ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1668)} ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1669)My recollection is that at the time the patches were developed, loop was not able to do discard operations. That has since changed and loop can do it. Hence the force of =1 was added in.
If the backend cant do discard then it should not advertise the feature.
Are you ok with me sending a patch which simplifies this function?
Olaf
Quoted 12 lines · Olaf Hering
[ removing Li who is no longer with Novell ]
Quoted 8 lines · Konrad Rzeszutek Wilk
You are looking at:
ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1664) } else if (strncmp(type, "file", 4) == 0) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1665) info->feature_discard = 1; ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1666) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1667) kfree(type); ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1668)} ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1669)
Quoted 5 lines
Quoted 3 lines
My recollection is that at the time the patches were developed, loop was not able to do discard operations. That has since changed and loop can do it. Hence the force of =1 was added in.
If the backend cant do discard then it should not advertise the feature.
<nods>
Quoted 2 lines
Are you ok with me sending a patch which simplifies this function?
Yes of course!
Quoted 2 lines
Olaf
Quoted 41 lines · Konrad Rzeszutek Wilk
Quoted 23 lines · Olaf Hering
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Olaf Hering
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"?
Because qdisk is the backend instead of loop+blk (==file) I think this just happens naturally.
Quoted 6 lines
Quoted 3 lines
Would the guest really care about that
detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.That sounds entirely bogus, it should be checking for some sort of feature-discard.
It does that, then calls
blkfront_setup_discardwhich in turn knows just about phy and file. And I wonder why it does that.
Maybe this function should be simplified to assume that if its calledfeature_discardcan be enabled. And if both discard-granularity/discard-alignment exist those properties should be assigned, similar for discard-secure.Quoted 4 lines
Now that I look at the history of
blkfront_setup_discard:Li, Konrad, why does that function care at all about the 'type'? Shouldnt that check be removed?
You are looking at:
ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1664) } else if (strncmp(type, "file", 4) == 0) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1665) info->feature_discard = 1; ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1666) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1667) kfree(type); ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1668)} ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1669)My recollection is that at the time the patches were developed, loop was not able to do discard operations. That has since changed and loop can do it. Hence the force of =1 was added in.
Quoted 5 lines
But that assumes that 'file' is going through the 'loop' device.
If that assumption is incorrect then this needs to be fixed and perhaps the underlaying device ('file'?) interogated as to whether it can do discard or not.
Why on earth is this happening in the frontend?
The *backend* should be querying the underlying device and propagating the result via the feature flag to the frontend. Having the backend advertise discard and then have the frontend second guess this based on rumour and hearsay (which is all probing this type field) is just nuts.
Ian.
Quoted 48 lines · Ian Campbell
Quoted 41 lines · Konrad Rzeszutek Wilk
Quoted 23 lines · Olaf Hering
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Olaf Hering
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"?
Because qdisk is the backend instead of loop+blk (==file) I think this just happens naturally.
Quoted 6 lines
Quoted 3 lines
Would the guest really care about that
detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.That sounds entirely bogus, it should be checking for some sort of feature-discard.
It does that, then calls
blkfront_setup_discardwhich in turn knows just about phy and file. And I wonder why it does that.
Maybe this function should be simplified to assume that if its calledfeature_discardcan be enabled. And if both discard-granularity/discard-alignment exist those properties should be assigned, similar for discard-secure.Quoted 4 lines
Now that I look at the history of
blkfront_setup_discard:Li, Konrad, why does that function care at all about the 'type'? Shouldnt that check be removed?
You are looking at:
ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1664) } else if (strncmp(type, "file", 4) == 0) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1665) info->feature_discard = 1; ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1666) ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1667) kfree(type); ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1668)} ed30bf317 (Li Dongyang 2011-09-01 18:39:09 +0800 1669)My recollection is that at the time the patches were developed, loop was not able to do discard operations. That has since changed and loop can do it. Hence the force of =1 was added in.
Quoted 5 lines
But that assumes that 'file' is going through the 'loop' device.
If that assumption is incorrect then this needs to be fixed and perhaps the underlaying device ('file'?) interogated as to whether it can do discard or not.
Quoted 6 lines
Why on earth is this happening in the frontend?
The *backend* should be querying the underlying device and propagating the result via the feature flag to the frontend. Having the backend advertise discard and then have the frontend second guess this based on rumour and hearsay (which is all probing this type field) is just nuts.
Madness I say!
Note that the discard operations are OK with errors. That is if the disk says 'I can do it' but returns -Exx whatever, the filesystems, tools etc are OK with that.
But it is incorrect. Worst yet, why do we even check for 'type' to figure this out is odd too.
Quoted 3 lines
Ian.
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Olaf Hering
What is the reason the backend 'type' property of a configured disk is now "qdisk" instead of "file"?
Because qdisk is the backend instead of loop+blk (==file) I think this just happens naturally.
Quoted 6 lines
Quoted 3 lines
Would the guest really care about that
detail? For example block-front currently just checks for "phy" and "file" when deciding if discard should be enabled.That sounds entirely bogus, it should be checking for some sort of feature-discard.
Linux blkfront checks for "feature-discard" on xenstore before trying to enable discard:
1795 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1796 "feature-discard", "%d", &discard,
1797 NULL);
1798
1799 if (!err && discard)
1800 blkfront_setup_discard(info);
But then in blkfront_setup_discard:
1615 type = xenbus_read(XBT_NIL, info->xbdev->otherend, "type", NULL);
1616 if (IS_ERR(type))
1617 return;
1618
1619 info->feature_secdiscard = 0;
1620 if (strncmp(type, "phy", 3) == 0) {
1621 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1622 "discard-granularity", "%u", &discard_granularity,
1623 "discard-alignment", "%u", &discard_alignment,
1624 NULL);
1625 if (!err) {
1626 info->feature_discard = 1;
1627 info->discard_granularity = discard_granularity;
1628 info->discard_alignment = discard_alignment;1629 }
1630 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1631 "discard-secure", "%d", &discard_secure,
1632 NULL);
1633 if (!err)
1634 info->feature_secdiscard = discard_secure;
1635
1636 } else if (strncmp(type, "file", 4) == 0)
1637 info->feature_discard = 1;
I don't understand why blkfront doesn't check directly for "discard- granularity" and "discard-alignment" and setup discard based on those parameters. Also, even if the backend sets "feature-discard" but the type is not "phy" or "file" discard will not be set.
The commit message that introduced those changes contains no info regarding why discard is only enabled for "phy" or "file" backends. Ccing Konrad and the original author of the change.
Roger.