Introduce vnode op supports_operation(), fix devfs_io()

devfs_io() can't fall back to calling vfs_synchronous_io(), if the
device driver doesn't support handling requests asynchronously. The
presence of the io() hook leads the VFS (do_iterative_fd_io()) to
believe that asynchronous handling is supported and set a
finished-callback on the request which calls the io() hook to start the
next chunk. Thus, instead of iterating through the request in a loop
the iteration happens recursively. For sufficiently fragmented requests
the stack may overflow (ticket #9900).

* Introduce a new vnode operation supports_operation(). It can be called
  by the VFS to determine whether a present hook is actually currently
  supported for a given vnode.
* devfs: implement the new hook and remove the fallback handling in
  devfs_io().
* vfs_request_io.cpp: use the new hook to determine whether the io()
  hook is really supported.
This commit is contained in:
Ingo Weinhold
2013-07-27 17:45:59 +02:00
parent b8130cf32d
commit 98a5231fe5
4 changed files with 105 additions and 49 deletions
+9
View File
@@ -45,6 +45,11 @@ struct file_io_vec {
#define B_VNODE_DONT_CREATE_SPECIAL_SUB_NODE 0x02
enum BVnodeOperation {
B_VNODE_OPERATION_IO = 0
};
#ifdef __cplusplus
extern "C" {
#endif
@@ -250,6 +255,10 @@ struct fs_vnode_ops {
const struct flock* lock, bool wait);
status_t (*release_lock)(fs_volume* volume, fs_vnode* vnode, void* cookie,
const struct flock* lock);
/* supported vnode operations info */
bool (*supports_operation)(fs_volume* volume, fs_vnode* vnode,
enum BVnodeOperation operation);
};
struct file_system_module_info {