Skip to contentSkip to conversation

fs: constify inode argument of inode_state_read_once()

PATCH In review Andrey Albershteyn 3 participants 4 messages Nov 11 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: constify inode argument of inode_state_read_once()

Constify inode parameter so that callers can pass const inode. Callers do not need a change.

---

Notes:
I will have a user with const inode in fsverity
https://lore.kernel.org/fsverity/[email protected]/

 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fs.h +1 -1
index 99caef43ff3c..c5ba625c8ae1 100644
@@ -877,7 +877,7 @@ struct inode {
  *
  * We hide all of it behind helpers so that we can validate consumers.
  */
-static inline enum inode_state_flags_enum inode_state_read_once(struct inode *inode)
+static inline enum inode_state_flags_enum inode_state_read_once(const struct inode *inode)
 {
 	return READ_ONCE(inode->i_state.__state);
 }
Signature · 1 line
2.54.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrey Albershteyn

Constify inode parameter so that callers can pass const inode. Callers do not need a change.

Fine by me. Feel free to add:

Honza

Quoted 25 lines

---

Notes:
I will have a user with const inode in fsverity
https://lore.kernel.org/fsverity/[email protected]/

 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fs.h +1 -1
index 99caef43ff3c..c5ba625c8ae1 100644
@@ -877,7 +877,7 @@ struct inode {
  *
  * We hide all of it behind helpers so that we can validate consumers.
  */
-static inline enum inode_state_flags_enum inode_state_read_once(struct inode *inode)
+static inline enum inode_state_flags_enum inode_state_read_once(const struct inode *inode)
 {
 	return READ_ONCE(inode->i_state.__state);
 }
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrey Albershteyn
Quoted 5 lines · Andrey Albershteyn

Constify inode parameter so that callers can pass const inode. Callers do not need a change.

---

Looks good:

Quoted 3 lines

Notes:
I will have a user with const inode in fsverity
https://lore.kernel.org/fsverity/[email protected]/

You probably want to include this patch in that series to reduce the amount of dependency tracking you have to do..

#3 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Andrey Albershteyn

Constify inode parameter so that callers can pass const inode. Callers do not need a change.

---

Looks good:

Thanks!

Quoted 7 lines
Quoted 4 lines

Notes:
I will have a user with const inode in fsverity
https://lore.kernel.org/fsverity/[email protected]/

You probably want to include this patch in that series to reduce the amount of dependency tracking you have to do..

Yeah, make sense, I will include it as a part of the series then

Signature · 1 line
- Andrey