diff options
| author | Anand Avati <avati@redhat.com> | 2014-03-27 06:35:34 -0700 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2014-04-20 18:07:24 -0700 | 
| commit | 81b32ab6e1c950577d0f2779db67283303e3e705 (patch) | |
| tree | 132bd346dea686cb79587cf94ac4e12de1e82033 /xlators/mount | |
| parent | bac02a359f86a742fbf750cf4f056160324d0746 (diff) | |
fuse: allow xlators to request for direct-io-mode on virtual files
Translators like meta, create virtual files with dynamic content
generated only at the time of open(). Therefore the file size
returned in lookup or stat is 0 (just like files in /proc). However
the VFS does not read beyond the size, and if the size is 0, no
READ ever reaches gluster for that file -- unless direct-io-mode
is enabled.
This patch allows translators to return "direct-io-mode" flag for
such 0-byte virtual files in xdata of open_cbk/create_cbk.
Change-Id: I3fe3312cd96baa4eecfe1247ab7255b4f455f049
BUG: 1089216
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/7506
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/mount')
| -rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 16 | 
1 files changed, 14 insertions, 2 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index d9055468e43..cbf256e8b85 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -869,6 +869,16 @@ out:          return ret;  } + +gf_boolean_t +direct_io_mode (dict_t *xdata) +{ +	if (xdata && dict_get (xdata, "direct-io-mode")) +		return _gf_true; +	return _gf_false; +} + +  static int  fuse_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,               int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) @@ -892,7 +902,8 @@ fuse_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  if (!IA_ISDIR (fd->inode->ia_type)) {                          if (((priv->direct_io_mode == 2)                               && ((state->flags & O_ACCMODE) != O_RDONLY)) -                            || (priv->direct_io_mode == 1)) +                            || (priv->direct_io_mode == 1) +			    || (direct_io_mode (xdata)))                                  foo.open_flags |= FOPEN_DIRECT_IO;  #ifdef GF_DARWIN_HOST_OS                          /* In Linux: by default, buffer cache @@ -1840,7 +1851,8 @@ fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  if (((priv->direct_io_mode == 2)                       && ((state->flags & O_ACCMODE) != O_RDONLY)) -                    || (priv->direct_io_mode == 1)) +                    || (priv->direct_io_mode == 1) +		    || direct_io_mode (xdata))                          foo.open_flags |= FOPEN_DIRECT_IO;                  gf_log ("glusterfs-fuse", GF_LOG_TRACE,  | 
