Re: mention vdrop in vhold.9

2012-09-16 Thread Jason McIntyre
On Sat, Sep 15, 2012 at 07:26:40PM -0700, Philip Guenther wrote:
 On Sat, Sep 15, 2012 at 1:42 AM, Jason McIntyre j...@kerhand.co.uk wrote:
  On Sat, Sep 15, 2012 at 10:19:35AM +0200, Michal Mazurek wrote:
   doesn;t the code mean the check is for zero, not less than or equal to
   zero?
 
  Oops, you're right.
 
  everything else looks alright. i'll commit it soon if no one objects,
  though i'd prefer it if another developer would ok it.
 
 I don't think we, in general, promise to panic.  Note that it won't if
 you compile without the DIAGNOSTIC option.
 

i think its fine since default is DIAGNOSTIC, but i'm fine with removing
that bit.

 As for the rest of the wording, I think it would be better if it
 mirrored the wording of the vhold() description, say:
 
 The vdrop() function decrements the v_holdcnt of the given vnode.  If the
 vnode is on the vnode hold list and its v_holdcnt and v_usecount
 are both zero,
 it will be removed from the vnode hold list and added to the free list.
 
 vhold() and vdrop() really are mirrors of each other like that...
 
 
 Philip
 

thanks, i think that reads better too. ok?
jmc

Index: Makefile
===
RCS file: /cvs/src/share/man/man9/Makefile,v
retrieving revision 1.171
diff -u -r1.171 Makefile
--- Makefile21 Jun 2012 18:02:21 -  1.171
+++ Makefile16 Sep 2012 09:53:04 -
@@ -373,5 +373,6 @@
 MLINKS+=workq_add_task.9 workq_create.9 \
workq_add_task.9 workq_queue_task.9 \
workq_add_task.9 workq_destroy.9
+MLINKS+=vhold.9 vdrop.9
 
 .include bsd.prog.mk
Index: vhold.9
===
RCS file: /cvs/src/share/man/man9/vhold.9,v
retrieving revision 1.6
diff -u -r1.6 vhold.9
--- vhold.9 15 Dec 2009 07:34:58 -  1.6
+++ vhold.9 16 Sep 2012 09:53:04 -
@@ -31,13 +31,16 @@
 .Dt VHOLD 9
 .Os
 .Sh NAME
-.Nm vhold
+.Nm vhold ,
+.Nm vdrop
 .Nd acquire a hold on a vnode
 .Sh SYNOPSIS
 .Fd #include sys/param.h
 .Fd #include sys/vnode.h
 .Ft void
 .Fn vhold struct vnode *vp
+.Ft void
+.Fn vdrop struct vnode *vp
 .Sh DESCRIPTION
 The
 .Fn vhold
@@ -50,6 +53,18 @@
 .Va v_usecount
 are both zero, it will be removed from the free list and
 added to the vnode hold list.
+.Pp
+The
+.Fn vdrop
+function decrements the
+.Va v_holdcnt
+of the given vnode.
+If the vnode is on the vnode hold list and its
+.Va v_holdcnt
+and
+.Va v_usecount
+are both zero, it will be removed from the vnode hold list and
+added to the freed list.
 .Sh SEE ALSO
 .Xr vnode 9
 .Sh AUTHORS



Re: mention vdrop in vhold.9

2012-09-16 Thread Jason McIntyre
On Sun, Sep 16, 2012 at 10:54:40AM +0059, Jason McIntyre wrote:
 
 thanks, i think that reads better too. ok?
 jmc
 

just spotted that the name description (Nd) for this file is now out of
date. updated accordingly (from freebsd).

ok?
jmc

Index: Makefile
===
RCS file: /cvs/src/share/man/man9/Makefile,v
retrieving revision 1.171
diff -u -r1.171 Makefile
--- Makefile21 Jun 2012 18:02:21 -  1.171
+++ Makefile16 Sep 2012 16:17:05 -
@@ -373,5 +373,6 @@
 MLINKS+=workq_add_task.9 workq_create.9 \
workq_add_task.9 workq_queue_task.9 \
workq_add_task.9 workq_destroy.9
+MLINKS+=vhold.9 vdrop.9
 
 .include bsd.prog.mk
Index: vhold.9
===
RCS file: /cvs/src/share/man/man9/vhold.9,v
retrieving revision 1.6
diff -u -r1.6 vhold.9
--- vhold.9 15 Dec 2009 07:34:58 -  1.6
+++ vhold.9 16 Sep 2012 16:17:05 -
@@ -31,13 +31,16 @@
 .Dt VHOLD 9
 .Os
 .Sh NAME
-.Nm vhold
-.Nd acquire a hold on a vnode
+.Nm vhold ,
+.Nm vdrop
+.Nd acquire/release a hold on a vnode
 .Sh SYNOPSIS
 .Fd #include sys/param.h
 .Fd #include sys/vnode.h
 .Ft void
 .Fn vhold struct vnode *vp
+.Ft void
+.Fn vdrop struct vnode *vp
 .Sh DESCRIPTION
 The
 .Fn vhold
@@ -50,6 +53,18 @@
 .Va v_usecount
 are both zero, it will be removed from the free list and
 added to the vnode hold list.
+.Pp
+The
+.Fn vdrop
+function decrements the
+.Va v_holdcnt
+of the given vnode.
+If the vnode is on the vnode hold list and its
+.Va v_holdcnt
+and
+.Va v_usecount
+are both zero, it will be removed from the vnode hold list and
+added to the freed list.
 .Sh SEE ALSO
 .Xr vnode 9
 .Sh AUTHORS



Re: mention vdrop in vhold.9

2012-09-16 Thread Philip Guenther
On Sun, Sep 16, 2012 at 9:18 AM, Jason McIntyre j...@kerhand.co.uk wrote:
 just spotted that the name description (Nd) for this file is now out of
 date. updated accordingly (from freebsd).

 ok?

Ship it!

guenther@



Re: mention vdrop in vhold.9

2012-09-16 Thread Jason McIntyre
On Fri, Sep 14, 2012 at 08:08:48PM +0200, Michal Mazurek wrote:
 Taken from FreeBSD.
 

an altered version of your diff was committed. thanks for the mail,
jmc



Re: mention vdrop in vhold.9

2012-09-15 Thread Jason McIntyre
On Fri, Sep 14, 2012 at 08:08:48PM +0200, Michal Mazurek wrote:
 Taken from FreeBSD.
 
 
 Index: Makefile
 ===
 RCS file: /cvs/src/share/man/man9/Makefile,v
 retrieving revision 1.171
 diff -u -p -r1.171 Makefile
 --- Makefile  21 Jun 2012 18:02:21 -  1.171
 +++ Makefile  14 Sep 2012 18:06:46 -
 @@ -373,5 +373,6 @@ MLINKS+=VOP_LOOKUP.9 VOP_ABORTOP.9 VOP_L
  MLINKS+=workq_add_task.9 workq_create.9 \
   workq_add_task.9 workq_queue_task.9 \
   workq_add_task.9 workq_destroy.9
 +MLINKS+=vhold.9 vdrop.9
  
  .include bsd.prog.mk
 Index: vhold.9
 ===
 RCS file: /cvs/src/share/man/man9/vhold.9,v
 retrieving revision 1.6
 diff -u -p -r1.6 vhold.9
 --- vhold.9   15 Dec 2009 07:34:58 -  1.6
 +++ vhold.9   14 Sep 2012 18:06:46 -
 @@ -38,6 +38,8 @@
  .Fd #include sys/vnode.h
  .Ft void
  .Fn vhold struct vnode *vp
 +.Ft void
 +.Fn vdrop struct vnode *vp
  .Sh DESCRIPTION
  The
  .Fn vhold
 @@ -50,6 +52,16 @@ and
  .Va v_usecount
  are both zero, it will be removed from the free list and
  added to the vnode hold list.
 +.Pp
 +The
 +.Fn vdrop
 +function decrements the
 +.Va v_holdcnt
 +of the vnode.
 +If the holdcount is less than or equal to zero prior to calling
 +.Fn vdrop ,
 +the system will panic.
 +If the vnode is no longer referenced, it will be freed.
  .Sh SEE ALSO
  .Xr vnode 9
  .Sh AUTHORS
 

in vfs_subr.c (bear with me ;) it has:

/* Lose interest in a vnode. */
void
vdrop(struct vnode *vp)
{
#ifdef DIAGNOSTIC
if (vp-v_holdcnt == 0)
panic(vdrop: zero holdcnt);
#endif

vp-v_holdcnt--;

the text pasted is:

If the holdcount is less than or equal to zero
prior to calling vdrop...

doesn;t the code mean the check is for zero, not less than or equal to
zero?

jmc



Re: mention vdrop in vhold.9

2012-09-15 Thread Michal Mazurek
On Sat, Sep 15, 2012 at 08:44:17AM +0100, Jason McIntyre wrote:
 in vfs_subr.c (bear with me ;) it has:
 
   /* Lose interest in a vnode. */
   void
   vdrop(struct vnode *vp)
   {
   #ifdef DIAGNOSTIC
   if (vp-v_holdcnt == 0)
   panic(vdrop: zero holdcnt);
   #endif
 
   vp-v_holdcnt--;
 
 the text pasted is:
 
   If the holdcount is less than or equal to zero
   prior to calling vdrop...
 
 doesn;t the code mean the check is for zero, not less than or equal to
 zero?


Oops, you're right.

Index: Makefile
===
RCS file: /cvs/src/share/man/man9/Makefile,v
retrieving revision 1.171
diff -u -p -r1.171 Makefile
--- Makefile21 Jun 2012 18:02:21 -  1.171
+++ Makefile14 Sep 2012 18:06:46 -
@@ -373,5 +373,6 @@ MLINKS+=VOP_LOOKUP.9 VOP_ABORTOP.9 VOP_L
 MLINKS+=workq_add_task.9 workq_create.9 \
workq_add_task.9 workq_queue_task.9 \
workq_add_task.9 workq_destroy.9
+MLINKS+=vhold.9 vdrop.9
 
 .include bsd.prog.mk
Index: vhold.9
===
RCS file: /cvs/src/share/man/man9/vhold.9,v
retrieving revision 1.6
diff -u -p -r1.6 vhold.9
--- vhold.9 15 Dec 2009 07:34:58 -  1.6
+++ vhold.9 14 Sep 2012 18:06:46 -
@@ -38,6 +38,8 @@
 .Fd #include sys/vnode.h
 .Ft void
 .Fn vhold struct vnode *vp
+.Ft void
+.Fn vdrop struct vnode *vp
 .Sh DESCRIPTION
 The
 .Fn vhold
@@ -50,6 +52,16 @@ and
 .Va v_usecount
 are both zero, it will be removed from the free list and
 added to the vnode hold list.
+.Pp
+The
+.Fn vdrop
+function decrements the
+.Va v_holdcnt
+of the vnode.
+If the holdcount is zero prior to calling
+.Fn vdrop ,
+the system will panic.
+If the vnode is no longer referenced, it will be freed.
 .Sh SEE ALSO
 .Xr vnode 9
 .Sh AUTHORS

-- 
Michal Mazurek



Re: mention vdrop in vhold.9

2012-09-15 Thread Jason McIntyre
On Sat, Sep 15, 2012 at 10:19:35AM +0200, Michal Mazurek wrote:
  
  doesn;t the code mean the check is for zero, not less than or equal to
  zero?
 
 
 Oops, you're right.
 

everything else looks alright. i'll commit it soon if no one objects,
though i'd prefer it if another developer would ok it.

jmc

 Index: Makefile
 ===
 RCS file: /cvs/src/share/man/man9/Makefile,v
 retrieving revision 1.171
 diff -u -p -r1.171 Makefile
 --- Makefile  21 Jun 2012 18:02:21 -  1.171
 +++ Makefile  14 Sep 2012 18:06:46 -
 @@ -373,5 +373,6 @@ MLINKS+=VOP_LOOKUP.9 VOP_ABORTOP.9 VOP_L
  MLINKS+=workq_add_task.9 workq_create.9 \
   workq_add_task.9 workq_queue_task.9 \
   workq_add_task.9 workq_destroy.9
 +MLINKS+=vhold.9 vdrop.9
  
  .include bsd.prog.mk
 Index: vhold.9
 ===
 RCS file: /cvs/src/share/man/man9/vhold.9,v
 retrieving revision 1.6
 diff -u -p -r1.6 vhold.9
 --- vhold.9   15 Dec 2009 07:34:58 -  1.6
 +++ vhold.9   14 Sep 2012 18:06:46 -
 @@ -38,6 +38,8 @@
  .Fd #include sys/vnode.h
  .Ft void
  .Fn vhold struct vnode *vp
 +.Ft void
 +.Fn vdrop struct vnode *vp
  .Sh DESCRIPTION
  The
  .Fn vhold
 @@ -50,6 +52,16 @@ and
  .Va v_usecount
  are both zero, it will be removed from the free list and
  added to the vnode hold list.
 +.Pp
 +The
 +.Fn vdrop
 +function decrements the
 +.Va v_holdcnt
 +of the vnode.
 +If the holdcount is zero prior to calling
 +.Fn vdrop ,
 +the system will panic.
 +If the vnode is no longer referenced, it will be freed.
  .Sh SEE ALSO
  .Xr vnode 9
  .Sh AUTHORS
 
 -- 
 Michal Mazurek



Re: mention vdrop in vhold.9

2012-09-15 Thread Philip Guenther
On Sat, Sep 15, 2012 at 1:42 AM, Jason McIntyre j...@kerhand.co.uk wrote:
 On Sat, Sep 15, 2012 at 10:19:35AM +0200, Michal Mazurek wrote:
  doesn;t the code mean the check is for zero, not less than or equal to
  zero?

 Oops, you're right.

 everything else looks alright. i'll commit it soon if no one objects,
 though i'd prefer it if another developer would ok it.

I don't think we, in general, promise to panic.  Note that it won't if
you compile without the DIAGNOSTIC option.

As for the rest of the wording, I think it would be better if it
mirrored the wording of the vhold() description, say:

The vdrop() function decrements the v_holdcnt of the given vnode.  If the
vnode is on the vnode hold list and its v_holdcnt and v_usecount
are both zero,
it will be removed from the vnode hold list and added to the free list.

vhold() and vdrop() really are mirrors of each other like that...


Philip



mention vdrop in vhold.9

2012-09-14 Thread Michal Mazurek
Taken from FreeBSD.


Index: Makefile
===
RCS file: /cvs/src/share/man/man9/Makefile,v
retrieving revision 1.171
diff -u -p -r1.171 Makefile
--- Makefile21 Jun 2012 18:02:21 -  1.171
+++ Makefile14 Sep 2012 18:06:46 -
@@ -373,5 +373,6 @@ MLINKS+=VOP_LOOKUP.9 VOP_ABORTOP.9 VOP_L
 MLINKS+=workq_add_task.9 workq_create.9 \
workq_add_task.9 workq_queue_task.9 \
workq_add_task.9 workq_destroy.9
+MLINKS+=vhold.9 vdrop.9
 
 .include bsd.prog.mk
Index: vhold.9
===
RCS file: /cvs/src/share/man/man9/vhold.9,v
retrieving revision 1.6
diff -u -p -r1.6 vhold.9
--- vhold.9 15 Dec 2009 07:34:58 -  1.6
+++ vhold.9 14 Sep 2012 18:06:46 -
@@ -38,6 +38,8 @@
 .Fd #include sys/vnode.h
 .Ft void
 .Fn vhold struct vnode *vp
+.Ft void
+.Fn vdrop struct vnode *vp
 .Sh DESCRIPTION
 The
 .Fn vhold
@@ -50,6 +52,16 @@ and
 .Va v_usecount
 are both zero, it will be removed from the free list and
 added to the vnode hold list.
+.Pp
+The
+.Fn vdrop
+function decrements the
+.Va v_holdcnt
+of the vnode.
+If the holdcount is less than or equal to zero prior to calling
+.Fn vdrop ,
+the system will panic.
+If the vnode is no longer referenced, it will be freed.
 .Sh SEE ALSO
 .Xr vnode 9
 .Sh AUTHORS

-- 
Michal Mazurek