public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] fs: inode: return proper error code in bmap()
@ 2023-07-15  8:22 Leesoo Ahn
       [not found] ` <cca223c5-b512-3913-a796-fa15341927ff@web.de>
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Leesoo Ahn @ 2023-07-15  8:22 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel; +Cc: Leesoo Ahn

Return -EOPNOTSUPP instead of -EINVAL which has the meaning of
the argument is an inappropriate value. The current error code doesn't
make sense to represent that a file system doesn't support bmap operation.

Signed-off-by: Leesoo Ahn <lsahn@wewakecorp.com>
---
Changes since v1:
- Modify the comments of bmap()
- Modify subject and description requested by Markus Elfring
https://lore.kernel.org/lkml/20230715060217.1469690-1-lsahn@wewakecorp.com/

 fs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 8fefb69e1f84..697c51ed226a 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1831,13 +1831,13 @@ EXPORT_SYMBOL(iput);
  *	4 in ``*block``, with disk block relative to the disk start that holds that
  *	block of the file.
  *
- *	Returns -EINVAL in case of error, 0 otherwise. If mapping falls into a
+ *	Returns -EOPNOTSUPP in case of error, 0 otherwise. If mapping falls into a
  *	hole, returns 0 and ``*block`` is also set to 0.
  */
 int bmap(struct inode *inode, sector_t *block)
 {
 	if (!inode->i_mapping->a_ops->bmap)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	*block = inode->i_mapping->a_ops->bmap(inode->i_mapping, *block);
 	return 0;
-- 
2.34.1


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

end of thread, other threads:[~2023-07-17 23:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-15  8:22 [PATCH v2] fs: inode: return proper error code in bmap() Leesoo Ahn
     [not found] ` <cca223c5-b512-3913-a796-fa15341927ff@web.de>
2023-07-15 13:20   ` Leesoo Ahn
2023-07-15 14:56 ` Matthew Wilcox
2023-07-17 15:11   ` Leesoo Ahn
2023-07-15 23:36 ` Dave Chinner
2023-07-17 15:08   ` Leesoo Ahn
2023-07-17 23:08     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox