1. 25 May, 2010 4 commits
    • Miklos Szeredi's avatar
      fuse: support splice() writing to fuse device · dd3bb14f
      Miklos Szeredi authored
      Allow userspace filesystem implementation to use splice() to write to
      the fuse device.  The semantics of using splice() are:
      
       1) buffer the message header and data in a temporary pipe
       2) with a *single* splice() call move the message from the temporary pipe
          to the fuse device
      
      The READ reply message has the most interesting use for this, since
      now the data from an arbitrary file descriptor (which could be a
      regular file, a block device or a socket) can be tranferred into the
      fuse device without having to go through a userspace buffer.  It will
      also allow zero copy moving of pages.
      
      One caveat is that the protocol on the fuse device requires the length
      of the whole message to be written into the header.  But the length of
      the data transferred into the temporary pipe may not be known in
      advance.  The current library implementation works around this by
      using vmplice to write the header and modifying the header after
      splicing the data into the pipe (error handling omitted):
      
      	struct fuse_out_header out;
      
      	iov.iov_base = &out;
      	iov.iov_len = sizeof(struct fuse_out_header);
      	vmsplice(pip[1], &iov, 1, 0);
      	len = splice(input_fd, input_offset, pip[1], NULL, len, 0);
      	/* retrospectively modify the header: */
      	out.len = len + sizeof(struct fuse_out_header);
      	splice(pip[0], NULL, fuse_chan_fd(req->ch), NULL, out.len, flags);
      
      This works since vmsplice only saves a pointer to the data, it does
      not copy the data itself.
      
      Since pipes are currently limited to 16 pages and messages need to be
      spliced atomically, the length of the data is limited to 15 pages (or
      60kB for 4k pages).
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      dd3bb14f
    • Miklos Szeredi's avatar
      fuse: get page reference for readpages · b5dd3285
      Miklos Szeredi authored
      Acquire a page ref on pages in ->readpages() and release them when the
      read has finished.  Not acquiring a reference didn't seem to cause any
      trouble since the page is locked and will not be kicked out of the
      page cache during the read.
      
      However the following patches will want to remove the page from the
      cache so a separate ref is needed.  Making the reference in req->pages
      explicit also makes the code easier to understand.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      b5dd3285
    • Miklos Szeredi's avatar
      fuse: use get_user_pages_fast() · 1bf94ca7
      Miklos Szeredi authored
      Replace uses of get_user_pages() with get_user_pages_fast().  It looks
      nicer and should be faster in most cases.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      1bf94ca7
    • Dan Carpenter's avatar
      fuse: remove unneeded variable · 4aa0edd2
      Dan Carpenter authored
      "map" isn't needed any more after: 0bd87182 "fuse: fix kunmap in
      fuse_ioctl_copy_user" 
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      4aa0edd2
  2. 24 May, 2010 23 commits
  3. 23 May, 2010 2 commits
  4. 22 May, 2010 11 commits