Skip to contentSkip to conversation

Doc fix for dget_dlock and dget

PATCH In review Anup K Parikh 2 participants 3 messages Aug 12, 2022 – Aug 15, 2022 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Doc fix for dget_dlock and dget

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

---
 include/linux/dcache.h | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
include/linux/dcache.h +19 -5
index f5bba5148..c7742006a 100644
@@ -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)
Signature · 1 line
2.35.1
#1 lore raw

Hi--

Quoted 7 lines · Anup K Parikh

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

Is Shuah going to merge this patch? I wouldn't expect that, so please see Documentation/process/submitting-patches.rst:
"Select the recipients for your patch" and send the patch to the appropriate maintainer(s) as well as the linux-fsdevel mailing list.

Thanks.

Quoted 47 lines
---
 include/linux/dcache.h | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
include/linux/dcache.h +19 -5
index f5bba5148..c7742006a 100644
@@ -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)
Signature · 1 line
~Randy
#2 lore raw

Hello Mr. Randy Dunlap,

I sent the patch as suggested. Thanks.

Regards,
Anup K Parikh.

Quoted 70 lines · Randy Dunlap

Hi--

Quoted 7 lines · Anup K Parikh

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

Is Shuah going to merge this patch? I wouldn't expect that, so please see Documentation/process/submitting-patches.rst:
"Select the recipients for your patch" and send the patch to the appropriate maintainer(s) as well as the linux-fsdevel mailing list.

Thanks.

Quoted 37 lines
---
 include/linux/dcache.h | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
include/linux/dcache.h +12 -5
index f5bba5148..c7742006a 100644
@@ -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
+ *

include/linux/dcache.h static inline struct dentry *dget_dlock(struct dentry *dentry) · line 330

Quoted 10 lines
include/linux/dcache.h +7 -0
+ * 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)

--
~Randy