patches/wb-quota.patch | 32 ++++++++++++++++++++++++++++++++
scripts/filt-cloud.py | 9 ++++++---
scripts/filt-quota.py | 33 +++++++++++++++++++++++++++++++++
xlators/cluster/cloud/src/cloud.c | 18 ++++++++++++++++++
4 files changed, 89 insertions(+), 3 deletions(-)
New commits:
commit b4349209955b1f234a9838d73b7c686fbb6d7fdb
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Dec 23 15:01:52 2010 -0500
Patch write-behind to play better with quota.
diff --git a/patches/wb-quota.patch b/patches/wb-quota.patch
new file mode 100644
index 0000000..a31b9e8
--- /dev/null
+++ b/patches/wb-quota.patch
@@ -0,0 +1,32 @@
+diff --git a/xlators/performance/write-behind/src/write-behind.c
b/xlators/performance/write-behind/src/write-behind.c
+index 43956a9..d97812a 100644
+--- a/xlators/performance/write-behind/src/write-behind.c
++++ b/xlators/performance/write-behind/src/write-behind.c
+@@ -1667,7 +1667,8 @@ __wb_get_other_requests (list_head_t *list, list_head_t
*other_requests)
+ int32_t
+ wb_stack_unwind (list_head_t *unwinds)
+ {
+- struct iatt buf = {0,};
++ struct iatt prebuf = {0,};
++ struct iatt postbuf = {0,};
+ wb_request_t *request = NULL, *dummy = NULL;
+ call_frame_t *frame = NULL;
+ wb_local_t *local = NULL;
+@@ -1678,8 +1679,15 @@ wb_stack_unwind (list_head_t *unwinds)
+ frame = request->stub->frame;
+ local = frame->local;
+
+- STACK_UNWIND (frame, local->op_ret, local->op_errno, &buf,
+- &buf);
++ /*
++ * There are probably a lot of other problems with returning
++ * these bogus iatts, but this fix at least gives us enough
++ * information for features/quota to work (sort of).
++ */
++ postbuf.ia_blocks = (request->write_size + 511) / 512;
++
++ STACK_UNWIND (frame, local->op_ret, local->op_errno,
++ &prebuf, &postbuf);
+
+ ret = wb_request_unref (request);
+ if (ret == 0) {
commit 06b429996ff9dd0d323b2f4f3bf919eb7c845939
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Dec 23 14:45:14 2010 -0500
Handle flush to avoid spurious errors from default wrapper.
diff --git a/xlators/cluster/cloud/src/cloud.c b/xlators/cluster/cloud/src/cloud.c
index 73d3c46..4be48a3 100644
--- a/xlators/cluster/cloud/src/cloud.c
+++ b/xlators/cluster/cloud/src/cloud.c
@@ -372,6 +372,23 @@ cloud_writev (call_frame_t *frame, xlator_t *this,
}
int
+cloud_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno)
+{
+ STACK_UNWIND_STRICT(flush,frame,op_ret,op_errno);
+ return 0;
+}
+
+int
+cloud_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
+{
+ xlator_t *next = get_subvol(this,frame->root->trans,"flush");
+
+ STACK_WIND(frame,cloud_flush_cbk,next,next->fops->flush,fd);
+ return 0;
+}
+
+int
cloud_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, fd_t *fd)
{
@@ -579,6 +596,7 @@ struct xlator_fops fops = {
.open = cloud_open,
.readv = cloud_readv,
.writev = cloud_writev,
+ .flush = cloud_flush,
.opendir = cloud_opendir,
.readdir = cloud_readdir,
.readdirp = cloud_readdirp,
commit 9d318d1ffa5bed64de03cb3e0f6492516fb0d854
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Dec 23 14:43:52 2010 -0500
Add script to auto-insert quota translator.
diff --git a/scripts/filt-quota.py b/scripts/filt-quota.py
new file mode 100755
index 0000000..36a5489
--- /dev/null
+++ b/scripts/filt-quota.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This file is part of CloudFS.
+#
+# CloudFS is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# CloudFS is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License *
+# along with CloudFS. If not, see <
http://www.gnu.org/licenses/>.
+
+import sys
+import volfilter
+
+if len(sys.argv) != 3:
+ print >> sys.stderr, "Usage: %s orig_volfile quota" % sys.argv[0]
+ sys.exit(1)
+
+graph, last = volfilter.load(sys.argv[1])
+new_xl = volfilter.Translator(last.name+"-quota")
+new_xl.type = "features/quota"
+new_xl.opts = {"disk-usage-limit":sys.argv[2]}
+new_xl.subvols = last.subvols
+last.subvols = [new_xl]
+volfilter.generate(graph,last)
commit 070f669bb8b9d15f8341a9a4f18af0dc78b41b04
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Dec 23 14:43:01 2010 -0500
Change per-tenant volume name to match translator's usage.
diff --git a/scripts/filt-cloud.py b/scripts/filt-cloud.py
index a055556..7389107 100755
--- a/scripts/filt-cloud.py
+++ b/scripts/filt-cloud.py
@@ -21,14 +21,17 @@ import copy
import sys
import volfilter
-def copy_stack (old_xl,suffix):
- new_name = old_xl.name + "-" + suffix
+def copy_stack (old_xl,suffix,recursive=False):
+ if recursive:
+ new_name = old_xl.name + "-" + suffix
+ else:
+ new_name = suffix
new_xl = volfilter.Translator(new_name)
new_xl.type = old_xl.type
# The results with normal assignment here are . . . amusing.
new_xl.opts = copy.deepcopy(old_xl.opts)
for sv in old_xl.subvols:
- new_xl.subvols.append(copy_stack(sv,suffix))
+ new_xl.subvols.append(copy_stack(sv,suffix,True))
# Patch up the path at the bottom.
if new_xl.type == "storage/posix":
new_xl.opts["directory"] += ("/" + suffix)