summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-23 22:36:17 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-08 01:42:39 -0700
commit26be5dc52d771b37d4e9da8814111448e4e68148 (patch)
tree09805a809045e55fa62eb02098f758159ef7227e /doc
parent155e6342d4f72d3be500510277b0808859ae2d2c (diff)
performance/stat-prefetch: flush stat corresponding to directory being read in readdir
- delete the entry corresponding to basename of path on which fd is opened from cache stored in parent. This is necessary because readdir changes st_atime. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 221 (stat prefetch implementation) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221
Diffstat (limited to 'doc')
-rw-r--r--doc/stat-prefetch-design.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/stat-prefetch-design.txt b/doc/stat-prefetch-design.txt
index 46bb3699d21..d10f841e69d 100644
--- a/doc/stat-prefetch-design.txt
+++ b/doc/stat-prefetch-design.txt
@@ -29,9 +29,11 @@ fops to be implemented:
the directory contents.
* readdir
- Cache the direntries returned in readdir_cbk in the context of fd. If the
- readdir is happening on non-expected offsets (means a seekdir/rewinddir
- has happened), cache has to be flushed.
+ 1. Cache the direntries returned in readdir_cbk in the context of fd.
+ 2. If the readdir is happening on non-expected offsets (means a seekdir/rewinddir
+ has happened), cache has to be flushed.
+ 3. Delete the entry corresponding to basename of path on which fd is opened
+ from cache stored in parent.
* chmod/fchmod
Delete the entry corresponding to basename from cache stored in context of
goto out;
+ }
+
+ ret = unlink (filename);
+ if (ret < 0) {
+ fprintf (stderr, "unlink failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = ftruncate (fd, 0);
+ if (ret < 0) {
+ fprintf (stderr, "ftruncate failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fstat (fd, &stbuf);
+ if (ret < 0) {
+ fprintf (stderr, "fstat failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fchmod (fd, 0640);
+ if (ret < 0) {
+ fprintf (stderr, "fchmod failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fchown (fd, 10001, 10001);
+ if (ret < 0) {
+ fprintf (stderr, "fchown failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fsync (fd);
+ if (ret < 0) {
+ fprintf (stderr, "fsync failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fsetxattr (fd, "trusted.xattr-test", "working", 8, 0);
+ if (ret < 0) {
+ fprintf (stderr, "fsetxattr failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fdatasync (fd);
+ if (ret < 0) {
+ fprintf (stderr, "fdatasync failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = flistxattr (fd, NULL, 0);
+ if (ret <= 0) {
+ ret = -1;
+ fprintf (stderr, "flistxattr failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fgetxattr (fd, "trusted.xattr-test", NULL, 0);
+ if (ret <= 0) {
+ ret = -1;
+ fprintf (stderr, "fgetxattr failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = fremovexattr (fd, "trusted.xattr-test");
+ if (ret < 0) {
+ fprintf (stderr, "fremovexattr failed : %s\n", strerror (errno));
+ goto out;
+ }
+
+ ret = 0;
+out:
+ if (fd)
+ close (fd);
+
+ return ret;
+}