From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: Re: [PATCH 8/19]: SCST SYSFS interface implementation Date: Wed, 10 Nov 2010 11:58:44 +0200 Message-ID: <4CDA6CD4.3010308@panasas.com> References: <20101011213235.GA11489@kroah.com> <4CB4AEB9.30501@vlnb.net> <20101012190345.GA25737@kroah.com> <4CB75E81.7000208@vlnb.net> <20101014200413.GA30831@kroah.com> <4CC1CA4D.1090609@vlnb.net> <20101022175624.GA13640@kroah.com> <4CC1DAA2.7030602@vlnb.net> <20101022185437.GA9103@kroah.com> <4CD8566D.1020202@vlnb.net> <20101109002829.GA22633@kroah.com> <4CD9A9B8.70708@vlnb.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from exprod5og103.obsmtp.com ([64.18.0.145]:46732 "HELO exprod5og103.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755280Ab0KJJ6u (ORCPT ); Wed, 10 Nov 2010 04:58:50 -0500 In-Reply-To: <4CD9A9B8.70708@vlnb.net> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Vladislav Bolkhovitin Cc: Greg KH , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, scst-devel , James Bottomley , Andrew Morton , FUJITA Tomonori , Mike Christie , Vu Pham , Bart Van Assche , James Smart , Joe Eykholt , Andy Yan , Chetan Loke , Dmitry Torokhov , Hannes Reinecke , Richard Sharpe , Daniel Henrique Debonzi On 11/09/2010 10:06 PM, Vladislav Bolkhovitin wrote: > > Sorry, but what is incorrect in the working implementation without any > bugs doing its job in the simplest, smallest and clearest way? > > If those objects remade to free themselves in the kobjects release(), > what value would it add to them? Would the implementation be simpler, > smaller or clearer? Not, I believe, new implementation would be only > bigger and less clear. So, what's the point to do it to make the code worse? > Totally theoretically speaking, since I have not inspected the code. If today you wait for the count to reach zero, then unregister and send an event to some other subsystem to free the object. Is it not the same as if you take an extra refcount, unregister and send the event at count=1. Then at that other place decrement the last count to cause the object to be freed. I agree that it is hard to do lockless. what some places do is have an extra kref. The kobj has a single ref on it. everything takes the other kref. when that reaches zero the unregister and event fires and at free you decrement the only kobj ref to deallocate. This is one way. In some situations you can manage with a single counter it all depends. Boaz