From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: [PATCH 01/26] document nlink function Date: Fri, 22 Jun 2007 13:03:04 -0700 Message-ID: <20070622200304.80022F05@kernel> References: <20070622200303.82D9CC3A@kernel> Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org, viro@ftp.linux.org.uk, Dave Hansen To: akpm@osdl.org Return-path: Received: from e32.co.us.ibm.com ([32.97.110.150]:51376 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbXFVUDY (ORCPT ); Fri, 22 Jun 2007 16:03:24 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e32.co.us.ibm.com (8.12.11.20060308/8.13.8) with ESMTP id l5MJwXLI008748 for ; Fri, 22 Jun 2007 15:58:33 -0400 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l5MK36MU227756 for ; Fri, 22 Jun 2007 14:03:12 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l5MK36Qb011089 for ; Fri, 22 Jun 2007 14:03:06 -0600 In-Reply-To: <20070622200303.82D9CC3A@kernel> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org These should have been documented from the beginning. Fix it. Signed-off-by: Dave Hansen --- lxc-dave/include/linux/fs.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff -puN include/linux/fs.h~document-nlink-funcs include/linux/fs.h --- lxc/include/linux/fs.h~document-nlink-funcs 2007-06-21 23:23:10.000000000 -0700 +++ lxc-dave/include/linux/fs.h 2007-06-21 23:23:10.000000000 -0700 @@ -1198,6 +1198,14 @@ static inline void mark_inode_dirty_sync __mark_inode_dirty(inode, I_DIRTY_SYNC); } +/** + * inc_nlink - directly increment an inode's link count + * @inode: inode + * + * This is a low-level filesystem helper to replace any + * direct filesystem manipulation of i_nlink. Currently, + * it is only here for parity with dec_nlink(). + */ static inline void inc_nlink(struct inode *inode) { inode->i_nlink++; @@ -1209,11 +1217,30 @@ static inline void inode_inc_link_count( mark_inode_dirty(inode); } +/** + * drop_nlink - directly drop an inode's link count + * @inode: inode + * + * This is a low-level filesystem helper to replace any + * direct filesystem manipulation of i_nlink. In cases + * where we are attempting to track writes to the + * filesystem, a decrement to zero means an imminent + * write when the file is truncated and actually unlinked + * on the filesystem. + */ static inline void drop_nlink(struct inode *inode) { inode->i_nlink--; } +/** + * clear_nlink - directly zero an inode's link count + * @inode: inode + * + * This is a low-level filesystem helper to replace any + * direct filesystem manipulation of i_nlink. See + * drop_nlink() for why we care about i_nlink hitting zero. + */ static inline void clear_nlink(struct inode *inode) { inode->i_nlink = 0; _