[PATCH] vfs: document readpage/writepage/writepages IO error handling

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

 



Everyone-

Does this look right?  Non-IO error behavior during writeback (e.g. 
ENOMEM) remains undefined.

thanks-
sage

---

Document correct use of page and address_space error bits for readpage,
writepage, and writepages on IO errors.

There are a few cases where ->writepage might get away with not marking
the mapping (the __writepage() wrapper in page-writeback.c will do it),
but only from certain call sites.

Signed-off-by: Sage Weil <sage@xxxxxxxxxxxx>
---
 Documentation/filesystems/vfs.txt |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index f49eecf..63b8cd9 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -554,6 +554,11 @@ struct address_space_operations {
       should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep
       calling ->writepage on that page.
 
+      If an error occurs (EIO or ENOSPC), ->writepage should mark the
+      page via SetPageError, mark the address_space via
+      set_mapping_error, and (when possible) return an error to the
+      caller.
+
       See the file "Locking" for more details.
 
   readpage: called by the VM to read a page from backing store.
@@ -564,6 +569,10 @@ struct address_space_operations {
        In this case, the page will be relocated, relocked and if
        that all succeeds, ->readpage will be called again.
 
+       If an error occurs, ->readpage should return an error code if
+       possible.  If it is an IO error, ->readpage should also mark
+       the page via SetPageError.
+
   sync_page: called by the VM to notify the backing store to perform all
   	queued I/O operations for a page. I/O operations for other pages
 	associated with this address_space object may also be performed.
@@ -580,6 +589,10 @@ struct address_space_operations {
   	instead.  This will choose pages from the address space that are
   	tagged as DIRTY and will pass them to ->writepage.
 
+	If an error occurs (EIO or ENOSPC), ->writepages should mark
+	the mapping via mapping_set_error(), and (when possible)
+	return an error to the caller.
+
   set_page_dirty: called by the VM to set a page dirty.
         This is particularly needed if an address space attaches
         private data to a page, and that data needs to be updated when
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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