Skip to contentSkip to conversation

block: Add notes to iSCSI's .bdrv_open and .bdrv_reopen_prepare

PATCH Applied Jeff Cody 2 participants 2 messages Feb 4, 2014 – Feb 14, 2014 Block layer

lore
Share & tools
lore

Jeff Cody

author
#0 lore raw

PATCH 1/1 block: Add notes to iSCSI's .bdrv_open and .bdrv_reopen_prepare

iSCSI currently does not need to do any actions to support the current usage of bdrv_reopen(). However, it is important to note a couple of things: 1.) A connection will not be re-established to an iSCSI target, and 2.) If iscsi_open() is changed to parse 'flags', then iscsi_reopen_prepare() may need to be more than a stub.

In light of the above, this commit adds comments above both of the functions to bring attention to these facts.

---
 block/iscsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
block/iscsi.c +8 -2
index 6f4af72..cb0ac69 100644
@@ -1099,6 +1099,10 @@ fail:
 /*
  * We support iscsi url's on the form
  * iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
+ *
+ * Note: flags are currently not used by iscsi_open.  If this function
+ * is changed such that flags are used, please examine iscsi_reopen_prepare()
+ * to see if needs to be changed as well.
  */
 static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
                       Error **errp)
@@ -1337,11 +1341,13 @@ static int iscsi_refresh_limits(BlockDriverState *bs)
     return 0;
 }
 
-/* We have nothing to do for iSCSI reopen, stub just returns
- * success */
+/* Since iscsi_open() ignores bdrv_flags, there is nothing to do here in
+ * prepare.  Note that this will not re-establish a connection with an iSCSI
+ * target - it is effectively a NOP.  */
 static int iscsi_reopen_prepare(BDRVReopenState *state,
                                 BlockReopenQueue *queue, Error **errp)
 {
+    /* NOP */
     return 0;
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 6 lines · Jeff Cody

iSCSI currently does not need to do any actions to support the current usage of bdrv_reopen(). However, it is important to note a couple of things: 1.) A connection will not be re-established to an iSCSI target, and 2.) If iscsi_open() is changed to parse 'flags', then iscsi_reopen_prepare() may need to be more than a stub.

Quoted 7 lines

In light of the above, this commit adds comments above both of the functions to bring attention to these facts.

---
 block/iscsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan