<feed xmlns='http://www.w3.org/2005/Atom'>
<title>glusterfs.git/libglusterfs/src/refcount.h, branch v3.12.5</title>
<subtitle>GlusterFS is a distributed file-system capable of scaling to several petabytes. It aggregates various storage bricks over Infiniband RDMA or TCP/IP interconnect into one large parallel network file system.</subtitle>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/'/>
<entry>
<title>multiple: fix struct/typedef inconsistencies</title>
<updated>2017-06-30T10:31:02+00:00</updated>
<author>
<name>Jeff Darcy</name>
<email>jdarcy@fb.com</email>
</author>
<published>2017-06-29T13:50:56+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/commit/?id=0be8e038d9bf90be94f3e3a7d6ea5bee88da9ecb'/>
<id>0be8e038d9bf90be94f3e3a7d6ea5bee88da9ecb</id>
<content type='text'>
The most common pattern, both in our code and elsewhere, is this:

   struct _xyz {
      ...
   };
   typedef struct _xyz xyz_t;

These exceptions - especially call_frame/call_stack - have been slowing
down code navigation for years.  By converging on a single pattern,
navigating from xyz_t in code to the actual definition of struct _xyz
(i.e. without having to visit the typedef first) might even be
automatable.

Change-Id: I0e5dd1f51f98e000173c62ef4ddc5b21d9ec44ed
Signed-off-by: Jeff Darcy &lt;jdarcy@fb.com&gt;
Reviewed-on: https://review.gluster.org/17650
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Tested-by: Jeff Darcy &lt;jeff@pl.atyp.us&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
Reviewed-by: Niels de Vos &lt;ndevos@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The most common pattern, both in our code and elsewhere, is this:

   struct _xyz {
      ...
   };
   typedef struct _xyz xyz_t;

These exceptions - especially call_frame/call_stack - have been slowing
down code navigation for years.  By converging on a single pattern,
navigating from xyz_t in code to the actual definition of struct _xyz
(i.e. without having to visit the typedef first) might even be
automatable.

Change-Id: I0e5dd1f51f98e000173c62ef4ddc5b21d9ec44ed
Signed-off-by: Jeff Darcy &lt;jdarcy@fb.com&gt;
Reviewed-on: https://review.gluster.org/17650
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Tested-by: Jeff Darcy &lt;jeff@pl.atyp.us&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
Reviewed-by: Niels de Vos &lt;ndevos@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>refcount: correct the return value of GF_REF_PUT()</title>
<updated>2017-03-22T01:00:17+00:00</updated>
<author>
<name>Niels de Vos</name>
<email>ndevos@redhat.com</email>
</author>
<published>2017-03-14T14:38:39+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/commit/?id=a1d60fe4e9ba46e2f472170e65043f5735af1fd5'/>
<id>a1d60fe4e9ba46e2f472170e65043f5735af1fd5</id>
<content type='text'>
It is documented that GF_REF_PUT() returns a 0 in case the call resulted
in free'ing the structure. However the implementations did not have a
return value, so nothing can actually use it.

Change-Id: Ic57091f5ddd7e0b80929dc335a5b6d37f5fe1b2e
BUG: 1433405
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: https://review.gluster.org/16910
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
Reviewed-by: Jeff Darcy &lt;jeff@pl.atyp.us&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is documented that GF_REF_PUT() returns a 0 in case the call resulted
in free'ing the structure. However the implementations did not have a
return value, so nothing can actually use it.

Change-Id: Ic57091f5ddd7e0b80929dc335a5b6d37f5fe1b2e
BUG: 1433405
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: https://review.gluster.org/16910
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
Reviewed-by: Jeff Darcy &lt;jeff@pl.atyp.us&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>refcount: typecast function for calling on free</title>
<updated>2017-01-31T05:04:44+00:00</updated>
<author>
<name>Niels de Vos</name>
<email>ndevos@redhat.com</email>
</author>
<published>2017-01-26T15:45:51+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/commit/?id=f2ca301bd741e3e3f076cd3f72fcd377bcef2a1a'/>
<id>f2ca301bd741e3e3f076cd3f72fcd377bcef2a1a</id>
<content type='text'>
All of the functions called to free the refcounted structure are doing a
typecast from (void*) to their own type taht is being free'd. This
really is not needed and the refcount interface is made a little simpler
without the requirement of typecasting.

With this small improvement in the API, all callers are updated too.

Change-Id: I32473b6d1799f62861d4b2d78ea30c09e6c80ab1
BUG: 1416889
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: https://review.gluster.org/16471
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All of the functions called to free the refcounted structure are doing a
typecast from (void*) to their own type taht is being free'd. This
really is not needed and the refcount interface is made a little simpler
without the requirement of typecasting.

With this small improvement in the API, all callers are updated too.

Change-Id: I32473b6d1799f62861d4b2d78ea30c09e6c80ab1
BUG: 1416889
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: https://review.gluster.org/16471
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>refcount: return pointer to the structure instead of a counter</title>
<updated>2016-12-11T08:47:05+00:00</updated>
<author>
<name>Niels de Vos</name>
<email>ndevos@redhat.com</email>
</author>
<published>2016-11-29T15:51:58+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/commit/?id=2f0e9ab1ef271132b8b7b1af25e23ac7bb0720c8'/>
<id>2f0e9ab1ef271132b8b7b1af25e23ac7bb0720c8</id>
<content type='text'>
There are no real users of the counter. It was thought of a handy tool
to track and debug refcounting, but it is not used at all. Some parts of
the code would benefit from a pointer getting returned instead.

BUG: 1399780
Change-Id: I97e52c48420fed61be942ea27ff4849b803eed12
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: http://review.gluster.org/15971
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are no real users of the counter. It was thought of a handy tool
to track and debug refcounting, but it is not used at all. Some parts of
the code would benefit from a pointer getting returned instead.

BUG: 1399780
Change-Id: I97e52c48420fed61be942ea27ff4849b803eed12
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: http://review.gluster.org/15971
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>refcount: correct the documentation</title>
<updated>2015-06-21T13:14:27+00:00</updated>
<author>
<name>Niels de Vos</name>
<email>ndevos@redhat.com</email>
</author>
<published>2015-06-19T09:36:25+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/commit/?id=c7f309116d8fa62f6b9fd6ff2902e8ce4bfa192d'/>
<id>c7f309116d8fa62f6b9fd6ff2902e8ce4bfa192d</id>
<content type='text'>
The only check that _gf_ref_get() needs is "== 0" for detecting a
failure. The actual return value is not guaranteed to be the number of
active refences (they can change in other threads anyway).

BUG: 1163543
Change-Id: I8801601eab37046f5a5ee0bce5a62606115ca151
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: http://review.gluster.org/11328
Tested-by: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
Tested-by: Gluster Build System &lt;jenkins@build.gluster.com&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The only check that _gf_ref_get() needs is "== 0" for detecting a
failure. The actual return value is not guaranteed to be the number of
active refences (they can change in other threads anyway).

BUG: 1163543
Change-Id: I8801601eab37046f5a5ee0bce5a62606115ca151
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: http://review.gluster.org/11328
Tested-by: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
Tested-by: Gluster Build System &lt;jenkins@build.gluster.com&gt;
Reviewed-by: Kaleb KEITHLEY &lt;kkeithle@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>core: add "gf_ref_t" for common refcounting structures</title>
<updated>2015-06-20T12:01:43+00:00</updated>
<author>
<name>Niels de Vos</name>
<email>ndevos@redhat.com</email>
</author>
<published>2015-05-31T13:16:41+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/anoopcs/public_git/glusterfs.git/commit/?id=ea1d2b0045e2c2ad82a2162a58f9fc36f9d07b20'/>
<id>ea1d2b0045e2c2ad82a2162a58f9fc36f9d07b20</id>
<content type='text'>
Checks for compiler supported atomic operations comes from client_t.h.

An example usage of this change can be found in adding reference
counting to "struct auth_cache_entry" in http://review.gluster.org/11023

Basic usage looks like this:

   #include "refcount.h"

   struct my_struct {
       GF_REF_DECL;
       ... /* more members */
   }

   void my_destructor (void *data)
   {
       struct my_struct *my_ptr = (struct my_struct *) data;

       ... /* do some more cleanups */
       GF_FREE (my_ptr);
   }

   void init_ptr (struct parent *parent)
   {
       struct my_struct *my_ptr = malloc (sizeof (struct my_struct));

       GF_REF_INIT (my_ptr, my_destructor); /* refcount is set to 1 */

       ... /* my_ptr probably gets added to some parent structure */
       parent_add_ptr (parent, my_ptr);
   }

   void do_something (struct parent *parent)
   {
       struct my_struct *my_ptr = NULL;

       /* likely need to lock parent, depends on its access pattern */
       my_ptr = parent_remove_first_ptr (parent);
       /* unlock parent */

       ... /* do something */

       GF_REF_PUT (my_ptr); /* calls my_destructor on refcount = 0 */
   }

URL: http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/11202
Change-Id: Idb98a5861a44c31676108ed8876db12c320912ef
BUG: 1228157
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: http://review.gluster.org/11022
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
Reviewed-by: Krishnan Parthasarathi &lt;kparthas@redhat.com&gt;
Tested-by: Gluster Build System &lt;jenkins@build.gluster.com&gt;
Tested-by: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Checks for compiler supported atomic operations comes from client_t.h.

An example usage of this change can be found in adding reference
counting to "struct auth_cache_entry" in http://review.gluster.org/11023

Basic usage looks like this:

   #include "refcount.h"

   struct my_struct {
       GF_REF_DECL;
       ... /* more members */
   }

   void my_destructor (void *data)
   {
       struct my_struct *my_ptr = (struct my_struct *) data;

       ... /* do some more cleanups */
       GF_FREE (my_ptr);
   }

   void init_ptr (struct parent *parent)
   {
       struct my_struct *my_ptr = malloc (sizeof (struct my_struct));

       GF_REF_INIT (my_ptr, my_destructor); /* refcount is set to 1 */

       ... /* my_ptr probably gets added to some parent structure */
       parent_add_ptr (parent, my_ptr);
   }

   void do_something (struct parent *parent)
   {
       struct my_struct *my_ptr = NULL;

       /* likely need to lock parent, depends on its access pattern */
       my_ptr = parent_remove_first_ptr (parent);
       /* unlock parent */

       ... /* do something */

       GF_REF_PUT (my_ptr); /* calls my_destructor on refcount = 0 */
   }

URL: http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/11202
Change-Id: Idb98a5861a44c31676108ed8876db12c320912ef
BUG: 1228157
Signed-off-by: Niels de Vos &lt;ndevos@redhat.com&gt;
Reviewed-on: http://review.gluster.org/11022
Reviewed-by: Xavier Hernandez &lt;xhernandez@datalab.es&gt;
Reviewed-by: Krishnan Parthasarathi &lt;kparthas@redhat.com&gt;
Tested-by: Gluster Build System &lt;jenkins@build.gluster.com&gt;
Tested-by: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
