> -----Original Message-----
> From: Jiri Pirko <j...@resnulli.us>
> Sent: Wednesday, April 29, 2020 9:53 PM
> To: Jakub Kicinski <k...@kernel.org>
> Cc: da...@davemloft.net; netdev@vger.kernel.org; kernel-t...@fb.com;
> Keller, Jacob E <jacob.e.kel...@intel.com>
> Subject: Re: [PATCH net-next v2] devlink: let kernel allocate region snapshot 
> id
> 
> Thu, Apr 30, 2020 at 01:38:13AM CEST, k...@kernel.org wrote:
> >-    snapshot_id = nla_get_u32(info-
> >attrs[DEVLINK_ATTR_REGION_SNAPSHOT_ID]);
> >+    snapshot_id_attr = info->attrs[DEVLINK_ATTR_REGION_SNAPSHOT_ID];
> >+    if (snapshot_id_attr) {
> >+            snapshot_id = nla_get_u32(snapshot_id_attr);
> >
> >-    if (devlink_region_snapshot_get_by_id(region, snapshot_id)) {
> >-            NL_SET_ERR_MSG_MOD(info->extack, "The requested snapshot
> id is already in use");
> >-            return -EEXIST;
> >-    }
> >+            if (devlink_region_snapshot_get_by_id(region, snapshot_id)) {
> >+                    NL_SET_ERR_MSG_MOD(info->extack, "The requested
> snapshot id is already in use");
> >+                    return -EEXIST;
> >+            }
> >
> >-    err = __devlink_snapshot_id_insert(devlink, snapshot_id);
> >-    if (err)
> >-            return err;
> >+            err = __devlink_snapshot_id_insert(devlink, snapshot_id);
> >+            if (err)
> >+                    return err;
> >+    } else {
> >+            err = devlink_nl_alloc_snapshot_id(devlink, info,
> >+                                               region, &snapshot_id);
> >+            if (err)
> >+                    return err;
> >+    }
> 
> Could you please send the snapshot id just before you return 0 in this
> function, as you offered in v1? I think it would be great to do it like
> that.
> 
> Thanks!


Also: Does it make sense to send the snapshot id regardless of whether it was 
auto-generated or not?

Thanks,
Jake

Reply via email to