[Gluster-devel] Please help me with my quota xlator :-)

Anand Avati avati at zresearch.com
Fri Jan 18 02:22:17 UTC 2008


Angel,
 gf_log() does not do format string check for bitsize against the arguments.
First use printf to verify the format string and then replace it with gf_log
if the compie happens without warnings.

avati

2008/1/18, Angel <clist at uah.es>:
>
> Hi
>
> Im experiencing problems try to implement simple functions for my pet
> xlator QUOTA
>
> stats mops from posix module seems nonsense, also rr sched seem to ignore
> them.
>
> My setup is:
>
> volume posix-brick0
>   type storage/posix                   # POSIX FS translator
>   option directory /home/export        # Export this directory
> end-volume
>
> volume posix-brick1
>   type storage/posix                   # POSIX FS translator
>   option directory /home/export2        # Export this directory
> end-volume
>
> volume posix-brick2
>   type storage/posix                   # POSIX FS translator
>   option directory /home/export3        # Export this directory
> end-volume
>
> volume quota-volume
>   type features/quota
>   subvolumes posix-brick0
>   option max-size 5MB
> end-volume
>
> volume unify-volume
>   type cluster/unify
>   option namespace posix-brick2
>   option scheduler rr
>   option rr.limits.min-free-disk 5
>   option rr.refresh-interval 2
>   subvolumes quota-volume posix-brick1
> end-volume
>
> ############################
>
> Quota tries to fool unify about size of posix-brick0.
>
> I got trace_stats_cbk from trace to adquire return values from stats mops.
>
> i hope things going like this (ASYNC calls):
>
> unifiy scheduler rr --> rr_*_stats( )  mops --> quota_stats( ) mops --->
> posix_stats mops
> posix_stats --> quota_stats_cbk  mops -->  rr_stats_cbk mops
>
> So i hacked quota_stats_cbk as this:
>
> INFO: quota allocate on init a quota_private struct *private and store prt
> on this->private
>
> static int32_t
> quota_stats_cbk (call_frame_t *frame,
>                  void *cookie,
>                  xlator_t *this,
>                  int32_t op_ret,
>                  int32_t op_errno,
>                  struct xlator_stats *stats)
> {
>   struct quota_private *private = NULL;
>
>   private = this->private;
> /* Here we control space available to upper modules */
>   if (private->storage_size > 0) {
>     if ( stats->total_disk_size > private->storage_size ) {
>       gf_log (this->name,
>               GF_LOG_WARNING,
>               "quota_stats_cbk (Limiting storage to %d (Was Total: %d
> Free: %d,Used: %d ))\n",
>               private->storage_size,
>               stats->total_disk_size,
>               stats->free_disk,
>               stats->disk_usage);
>       stats->total_disk_size = private->storage_size;
>     }
>   }
>
>   STACK_UNWIND (frame, op_ret, op_errno, stats);
>   return 0;
> }
>
> This code doesnt work!!
>
> Test:
> $cd /home/sinosuke/mnt
> $for a in $(seq 1 4); do echo "Bloque $a"; dd if=/dev/urandom
> of=test$a.txt bs=10 count=1; sleep 1; done
>
> Code prints:
>
> 2008-01-18 01:24:05 W [quota.c:2204:quota_stats_cbk] quota-volume:
> quota_stats_cbk (Limiting storage to 5242880 ( Was Total: 0 Free:
> 1586819072,Used: 12 ))
> 2008-01-18 01:24:09 W [quota.c:2204:quota_stats_cbk] quota-volume:
> quota_stats_cbk (Limiting storage to 5242880 ( Was Total: 0 Free:
> 1586819072,Used: 12 ))
>
> Why stats from posix-brick0 always show the same nonsense values??
> Does really rr scheduler use them for disk space control??
>
> Im confused
>
> Regards
> --
> ------------------------------------------------
> Clist UAH
> ------------------------------------------------
>
>
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at nongnu.org
> http://lists.nongnu.org/mailman/listinfo/gluster-devel
>



-- 
If I traveled to the end of the rainbow
As Dame Fortune did intend,
Murphy would be there to tell me
The pot's at the other end.



More information about the Gluster-devel mailing list