Patchwork [Gluster-devel] 2.0.6 patch for io-cache pattern-matched non-caching

login
register
Submitter Stephan von Krawczynski
Date 2009-09-14 11:29:55
Message ID <20090914132955.1c5b85d3.skraw@ithnet.com>
Download mbox | patch
Permalink /patch/1319/
State Accepted
Headers show

Comments

Stephan von Krawczynski - 2009-09-14 11:29:55
Hello all,

here is a small feature patch. Its intention is to give the user more control
over the files performance/io-cache really caches. If the user knows exactly
which files should be cached and which shouldn't there is currently no way to
tell glusterfs _not_ to cache certain pattern. This patch allows you to
disable caching by setting the priority of a pattern to "0". If you do not
give any priority option it works just like before and caches everything.
Honestly I am not totally sure that disabling caching works the way we did it,
please comment.
Anand Avati - 2009-09-15 07:11:52
Stephan,
  This patch looks fine. Can you please file an enhancement bug in
bugzilla with a brief description, and use ./format-patch.sh to
generate the patch against the bug id and use git send-mail to submit
the patch to gluster-devel? All commits going to glusterfs repository
are tracked by a bug id, including enhancements.

Thanks,
Avati


On Mon, Sep 14, 2009 at 4:59 PM, Stephan von Krawczynski
<skraw@ithnet.com> wrote:
> Hello all,
>
> here is a small feature patch. Its intention is to give the user more control
> over the files performance/io-cache really caches. If the user knows exactly
> which files should be cached and which shouldn't there is currently no way to
> tell glusterfs _not_ to cache certain pattern. This patch allows you to
> disable caching by setting the priority of a pattern to "0". If you do not
> give any priority option it works just like before and caches everything.
> Honestly I am not totally sure that disabling caching works the way we did it,
> please comment.
>
> --
> Regards,
> Stephan
>
>
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/gluster-devel
>
>
Stephan von Krawczynski - 2009-09-15 11:16:06
On Tue, 15 Sep 2009 12:41:52 +0530
Anand Avati <avati@gluster.com> wrote:

> Stephan,
>   This patch looks fine. Can you please file an enhancement bug in
> bugzilla with a brief description, and use ./format-patch.sh to
> generate the patch against the bug id and use git send-mail to submit
> the patch to gluster-devel? All commits going to glusterfs repository
> are tracked by a bug id, including enhancements.
> 
> Thanks,
> Avati

Hello Avati,

the patch - being so small - should be understood more like a short hint in c
language to the programmer in charge of the corresponding file. He will - if
he likes it - write the few lines in below one minute. On the other hand I
will need around an hour worktime just to meet your requirements of filing a
patch.
Honestly this is not my understanding of effectiveness in work. Moreover I am
not interested at all in getting more google-famous than today just because of
filing micro-patches to all kinds of ongoing projects. So there is no need to
link my name forever in a database with this patch.
If you like the idea behind the patch just use it. If not there is exactly
nothing I can do to convince you. It's not the spoon that's bending ;-)

Patch

--- glusterfs-2.0.6/xlators/performance/io-cache/src/io-cache.c	2009-08-14 01:32:51.000000000 +0200
+++ glusterfs-2.0.6-skraw/xlators/performance/io-cache/src/io-cache.c	2009-09-12 15:00:52.000000000 +0200
@@ -553,9 +553,14 @@ 
 	uint32_t            priority = 0;
 	struct ioc_priority *curr = NULL;
   
-	list_for_each_entry (curr, &table->priority_list, list) {
-		if (is_match (path, curr->pattern)) 
-			priority = curr->priority;
+	if (list_empty(&table->priority_list)) {
+		priority = 1;
+	}
+	else {
+		list_for_each_entry (curr, &table->priority_list, list) {
+			if (is_match (path, curr->pattern)) 
+				priority = curr->priority;
+		}
 	}
 
 	return priority;
@@ -581,7 +586,7 @@ 
 	ioc_table_t *table = NULL;
 	ioc_inode_t *ioc_inode = NULL;
 	inode_t     *inode = NULL;
-	uint32_t    weight = 0;
+	uint32_t    weight = 0xffffffff;
 	const char  *path = NULL;
 
         local = frame->local;
@@ -633,6 +638,13 @@ 
 			 */
 			fd_ctx_set (fd, this, 1);
 		}
+
+		/* weight = 0, we disable caching on it */
+		if (weight == 0) {
+			/* we allow a pattern-matched cache disable this way 
+			 */
+			fd_ctx_set (fd, this, 1);
+		}
 	}
 
 	FREE (local);
@@ -664,7 +676,7 @@ 
 	ioc_local_t *local = NULL;
 	ioc_table_t *table = NULL;
 	ioc_inode_t *ioc_inode = NULL;
-	uint32_t    weight = 0;
+	uint32_t    weight = 0xffffffff;
 	const char  *path = NULL;
 
         local = frame->local;
@@ -699,6 +711,12 @@ 
 			fd_ctx_set (fd, this, 1);
 		}
     
+		/* weight = 0, we disable caching on it */
+		if (weight == 0) {
+			/* we allow a pattern-matched cache disable this way 
+			 */
+			fd_ctx_set (fd, this, 1);
+		}
 	}
   
 	frame->local = NULL;