linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Doc fix for dget_dlock and dget
@ 2022-08-12  9:47 Anup K Parikh
  2022-08-13  1:44 ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Anup K Parikh @ 2022-08-12  9:47 UTC (permalink / raw)
  To: rdunlap, skhan; +Cc: linux-fsdevel

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] Doc fix for dget_dlock and dget
@ 2022-08-13  8:20 Anup K Parikh
  0 siblings, 0 replies; 4+ messages in thread
From: Anup K Parikh @ 2022-08-13  8:20 UTC (permalink / raw)
  To: bigeasy, mcgrof, xiubli, akpm, jlayton, skhan; +Cc: linux-kernel, linux-fsdevel

dcache header:

1. Remove a warning for dget_dlock

2. Add a similar comment for dget and
   mention the difference between dget and dget_dlock
   as suggested by Mr. Randy Dunlap
   Link: https://lore.kernel.org/all/29708eb3-ff1e-411e-cf84-7aa9af765603@infradead.org/

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 92c78ed02..aa473b6bf 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -299,12 +299,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)
 {
@@ -313,6 +316,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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-15  6:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12  9:47 [PATCH] Doc fix for dget_dlock and dget Anup K Parikh
2022-08-13  1:44 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).