Linux filesystem development
 help / color / mirror / Atom feed
From: Anup K Parikh <parikhanupk.foss@gmail.com>
To: rdunlap@infradead.org, skhan@linuxfoundation.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] Doc fix for dget_dlock and dget
Date: Fri, 12 Aug 2022 15:17:36 +0530	[thread overview]
Message-ID: <YvYhuH66yfoi8Zxy@autolfshost> (raw)

1. Remove a warning for dget_dlock

2. Add a similar comment for dget and
   add difference between dget and dget_dlock
   as suggested by Mr. Randy Dunlap

Signed-off-by: Anup K Parikh <parikhanupk.foss@gmail.com>
---
 include/linux/dcache.h | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index f5bba5148..c7742006a 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -297,12 +297,15 @@ extern char *dentry_path(const struct dentry *, char *, int);
 /* Allocation counts.. */
 
 /**
- *	dget, dget_dlock -	get a reference to a dentry
- *	@dentry: dentry to get a reference to
+ * dget_dlock - get a reference to a dentry
+ * @dentry: dentry to get a reference to
  *
- *	Given a dentry or %NULL pointer increment the reference count
- *	if appropriate and return the dentry. A dentry will not be 
- *	destroyed when it has references.
+ * Given a dentry or %NULL pointer increment the reference count
+ * if appropriate and return the dentry. A dentry will not be
+ * destroyed when it has references.
+ *
+ * The reference count increment in this function is not atomic.
+ * Consider dget() if atomicity is required.
  */
 static inline struct dentry *dget_dlock(struct dentry *dentry)
 {
@@ -311,6 +314,17 @@ static inline struct dentry *dget_dlock(struct dentry *dentry)
 	return dentry;
 }
 
+/**
+ * dget - get a reference to a dentry
+ * @dentry: dentry to get a reference to
+ *
+ * Given a dentry or %NULL pointer increment the reference count
+ * if appropriate and return the dentry. A dentry will not be
+ * destroyed when it has references.
+ *
+ * This function atomically increments the reference count.
+ * Consider dget_dlock() if atomicity is not required or manually managed.
+ */
 static inline struct dentry *dget(struct dentry *dentry)
 {
 	if (dentry)
-- 
2.35.1


             reply	other threads:[~2022-08-12  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12  9:47 Anup K Parikh [this message]
2022-08-13  1:44 ` [PATCH] Doc fix for dget_dlock and dget Randy Dunlap
2022-08-15  6:55   ` Anup Parikh
  -- strict thread matches above, loose matches on Subject: below --
2022-08-13  8:20 Anup K Parikh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YvYhuH66yfoi8Zxy@autolfshost \
    --to=parikhanupk.foss@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox