mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: fix misleading comments in read_write.c
@ 2026-09-14  7:53 Yingchao Deng
  2026-09-14 10:05 ` Jan Kara
  2026-09-17 10:33 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Yingchao Deng @ 2026-09-14  7:53 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara
  Cc: linux-fsdevel, linux-kernel, qinyungao, Yingchao Deng

generic_write_checks() returns the number of bytes that may be written
(possibly truncated by generic_write_check_limits()), not zero.  The
comment was likely copied from generic_copy_file_checks(), which is the
analogous function for copy_file_range() and does return 0 on success.

Also, no_seek_end_llseek() and no_seek_end_llseek_size() are helpers for
files that do not support SEEK_END (they only handle SEEK_SET and
SEEK_CUR), not for "fixed-sized devices"; that description was copied
from fixed_size_llseek().

Signed-off-by: Yingchao Deng <dengyingchao@kylinsec.com.cn>
---
 fs/read_write.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index e8c14e2760b2..4da846a2bf17 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -274,7 +274,7 @@ loff_t fixed_size_llseek(struct file *file, loff_t offset, int whence, loff_t si
 EXPORT_SYMBOL(fixed_size_llseek);
 
 /**
- * no_seek_end_llseek - llseek implementation for fixed-sized devices
+ * no_seek_end_llseek - llseek implementation for files without SEEK_END
  * @file:	file structure to seek on
  * @offset:	file offset to seek to
  * @whence:	type of seek
@@ -293,7 +293,7 @@ loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
 EXPORT_SYMBOL(no_seek_end_llseek);
 
 /**
- * no_seek_end_llseek_size - llseek implementation for fixed-sized devices
+ * no_seek_end_llseek_size - llseek implementation for files without SEEK_END
  * @file:	file structure to seek on
  * @offset:	file offset to seek to
  * @whence:	type of seek
@@ -1761,8 +1761,8 @@ EXPORT_SYMBOL(generic_write_checks_count);
  * Performs necessary checks before doing a write
  *
  * Can adjust writing position or amount of bytes to write.
- * Returns appropriate error code that caller should return or
- * zero in case that write should be allowed.
+ * Returns the number of bytes that may be written on success (which
+ * may be less than requested if truncated), or a negative error code.
  */
 ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)
 {
-- 
2.33.0


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

end of thread, other threads:[~2026-09-17 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14  7:53 [PATCH] fs: fix misleading comments in read_write.c Yingchao Deng
2026-09-14 10:05 ` Jan Kara
2026-09-17 10:33 ` Christian Brauner

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

all inboxes | Powered by JetHome®