[PATCH 3/9] orangefs: make open_for_read and open_for_write boolean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sparse currently warns:

fs/orangefs/file.c:119:32: warning: incorrect type in assignment (different base types)
fs/orangefs/file.c:119:32:    expected int open_for_write
fs/orangefs/file.c:119:32:    got restricted fmode_t

Turning open_for_write and open_for_read into booleans (which is how
they're used) removes this warning.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
 fs/orangefs/file.c         | 4 ++--
 include/linux/mm_types.h   | 6 +++---
 include/linux/nfs_page.h   | 2 +-
 include/linux/page-flags.h | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index d68372241b30..90c49c0de243 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -57,8 +57,8 @@ ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode,
 	int buffer_index;
 	ssize_t ret;
 	size_t copy_amount;
-	int open_for_read;
-	int open_for_write;
+	bool open_for_read;
+	bool open_for_write;
 
 	new_op = op_alloc(ORANGEFS_VFS_OP_FILE_IO);
 	if (!new_op)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index e1f23c3429c9..0ca9feec67b8 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -101,7 +101,7 @@ struct page {
 				struct list_head pcp_list;
 			};
 			/* See page-flags.h for PAGE_MAPPING_FLAGS */
-			struct address_space *mapping;
+			struct address_space *__folio_mapping;
 			union {
 				pgoff_t __folio_index;		/* Our offset within mapping. */
 				unsigned long share;	/* share count for fsdax */
@@ -403,7 +403,7 @@ struct folio {
 	static_assert(offsetof(struct page, pg) == offsetof(struct folio, fl))
 FOLIO_MATCH(flags, flags);
 FOLIO_MATCH(lru, lru);
-FOLIO_MATCH(mapping, mapping);
+FOLIO_MATCH(__folio_mapping, mapping);
 FOLIO_MATCH(compound_head, lru);
 FOLIO_MATCH(__folio_index, index);
 FOLIO_MATCH(private, private);
@@ -499,7 +499,7 @@ struct ptdesc {
 TABLE_MATCH(flags, __page_flags);
 TABLE_MATCH(compound_head, pt_list);
 TABLE_MATCH(compound_head, _pt_pad_1);
-TABLE_MATCH(mapping, __page_mapping);
+TABLE_MATCH(__folio_mapping, __page_mapping);
 TABLE_MATCH(__folio_index, pt_index);
 TABLE_MATCH(rcu_head, pt_rcu_head);
 TABLE_MATCH(page_type, __page_type);
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 169b4ae30ff4..0db50ce065cb 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -205,7 +205,7 @@ static inline struct inode *nfs_page_to_inode(const struct nfs_page *req)
 	struct folio *folio = nfs_page_to_folio(req);
 
 	if (folio == NULL)
-		return req->wb_page->mapping->host;
+		return req->wb_folio->mapping->host;
 	return folio->mapping->host;
 }
 
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 36d283552f80..796fabeae46f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -675,7 +675,7 @@ PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted)
 
 /*
  * Different with flags above, this flag is used only for fsdax mode.  It
- * indicates that this page->mapping is now under reflink case.
+ * indicates that this folio->mapping is now under reflink case.
  */
 #define PAGE_MAPPING_DAX_SHARED	((void *)0x1)
 
@@ -686,7 +686,7 @@ static __always_inline bool folio_mapping_flags(const struct folio *folio)
 
 static __always_inline bool PageMappingFlags(const struct page *page)
 {
-	return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != 0;
+	return ((unsigned long)page->__folio_mapping & PAGE_MAPPING_FLAGS) != 0;
 }
 
 static __always_inline bool folio_test_anon(const struct folio *folio)
@@ -714,7 +714,7 @@ static __always_inline bool __folio_test_movable(const struct folio *folio)
 
 static __always_inline bool __PageMovable(const struct page *page)
 {
-	return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
+	return ((unsigned long)page->__folio_mapping & PAGE_MAPPING_FLAGS) ==
 				PAGE_MAPPING_MOVABLE;
 }
 
-- 
2.47.2





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux