Re: [patch net-next v3 02/10] switchdev: introduce transaction item queue for attr_set and obj_add
From: David Miller <davem@davemloft.net>
Date: 2015-09-25 05:55:09
From: David Miller <davem@davemloft.net>
Date: 2015-09-25 05:55:09
From: Scott Feldman <redacted> Date: Thu, 24 Sep 2015 22:29:43 -0700
I'd rather keep 2-phase not optional, or at least make it some what of a pain for drivers to opt-out of 2-phase. Forcing the driver to see both phases means the driver needs to put some code to skip phase 1 (and hopefully has some persistent comment explaining why its being skipped). Something like: /* I'm skipping phase 1 prepare for this operation. I have infinite hardware * resources and I'm not setting any persistent state in the driver or device * and I don't need any dynamic resources from the kernel, so its impossible * for me to fail phase 2 commit. Nothing to prepare, sorry. */
I agree with Scott here. If you can opt out of something, you can not think about it and thus more likely get it wrong. I can just see a driver not implementing prepare at all and then doing stupid things in commit when they hit some resource limit or whatever, rather than taking care of such issues in prepare.