All of lore.kernel.org
 help / color / mirror / Atom feed
From: adas@sourceware.org <adas@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster gfs-kernel/src/gfs/ioctl.c gfs/gfs_quo ...
Date: 10 Jan 2007 17:53:55 -0000	[thread overview]
Message-ID: <20070110175355.3541.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	adas at sourceware.org	2007-01-10 17:53:54

Modified files:
	gfs-kernel/src/gfs: ioctl.c 
	gfs/gfs_quota  : Makefile main.c gfs_quota.h 
Added files:
	gfs/gfs_quota  : layout.c 

Log message:
	fix bz 210362: We don't run through the entire gfs_quota sparse file to do a list operation anymore. We get the layout of the gfs_quota file on disk and only read quota information off the data blocks that are actually in use. Also added functionality to GFS_IOCTL_SUPER to provide the metadata of the hidden quota file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ioctl.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.4&r2=1.7.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_quota/layout.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_quota/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3&r2=1.3.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_quota/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_quota/gfs_quota.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2&r2=1.2.2.1

--- cluster/gfs-kernel/src/gfs/ioctl.c	2006/11/13 19:25:46	1.7.2.4
+++ cluster/gfs-kernel/src/gfs/ioctl.c	2007/01/10 17:53:53	1.7.2.5
@@ -1464,6 +1464,8 @@
 		error = gi_set_file_flag(ip, &gi);
 	else if (strcmp(arg0, "get_file_meta") == 0)
 		error = gi_get_file_meta(ip, &gi);
+	else if (strcmp(arg0, "get_file_meta_quota") == 0)
+		error = gi_get_file_meta(ip->i_sbd->sd_qinode, &gi);
 	else if (strcmp(arg0, "do_file_flush") == 0)
 		error = gi_do_file_flush(ip, &gi);
 	else if (strcmp(arg0, "get_hfile_stat") == 0)
--- cluster/gfs/gfs_quota/Makefile	2004/09/10 19:02:15	1.3
+++ cluster/gfs/gfs_quota/Makefile	2007/01/10 17:53:54	1.3.2.1
@@ -19,7 +19,8 @@
 	check.c \
 	main.c \
 	names.c \
-	ondisk.c
+	ondisk.c \
+	layout.c
 
 CFLAGS+= -O2 -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 \
 	-DGFS_RELEASE_NAME=\"${RELEASE}\"
--- cluster/gfs/gfs_quota/main.c	2005/01/04 10:07:09	1.2
+++ cluster/gfs/gfs_quota/main.c	2007/01/10 17:53:54	1.2.2.1
@@ -345,7 +345,7 @@
  *
  */
 
-static void
+void
 print_quota(commandline_t *comline,
 	    int user, uint32_t id,
 	    struct gfs_quota *q,
@@ -399,71 +399,10 @@
  *
  */
 
-static void
+static void 
 do_list(commandline_t *comline)
 {
-	int fd;
-	struct gfs_sb sb;
-	struct gfs_ioctl gi;
-	char buf[sizeof(struct gfs_quota)];
-	struct gfs_quota q;
-	uint64_t offset;
-	uint64_t hidden_blocks = 0;
-	uint32_t id;
-	int pass = 0;
-	int error;
-
-	if (!*comline->filesystem)
-		die("need a filesystem to work on\n");
-
-	fd = open(comline->filesystem, O_RDONLY);
-	if (fd < 0)
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	check_for_gfs(fd, comline->filesystem);
-	do_get_super(fd, &sb);
-
-	if (comline->no_hidden_file_blocks)
-		hidden_blocks = compute_hidden_blocks(comline, fd);
-
-	for (pass = 0; pass < 2; pass++) {
-		if (!pass)
-			offset = 0;
-		else
-			offset = sizeof(struct gfs_quota);
-
-		do {
-			char *argv[] = { "do_hfile_read", "quota" };
-
-			gi.gi_argc = 2;
-			gi.gi_argv = argv;
-			gi.gi_data = buf;
-			gi.gi_size = sizeof(struct gfs_quota);
-			gi.gi_offset = offset;
-
-			memset(buf, 0, sizeof(struct gfs_quota));
-
-			error = ioctl(fd, GFS_IOCTL_SUPER, &gi);
-			if (error < 0)
-				die("can't read quota file: %s\n",
-				    strerror(errno));
-
-			gfs_quota_in(&q, buf);
-
-			id = (offset / sizeof(struct gfs_quota)) >> 1;
-			if (!id && comline->no_hidden_file_blocks)
-				q.qu_value -= hidden_blocks;
-
-			if (q.qu_limit || q.qu_warn || q.qu_value)
-				print_quota(comline, (pass) ? FALSE : TRUE, id,
-					    &q, &sb);
-
-			offset += 2 * sizeof(struct gfs_quota);
-		} while (error == sizeof(struct gfs_quota));
-	}
-
-	close(fd);
+	print_quota_file(comline);
 }
 
 /**
--- cluster/gfs/gfs_quota/gfs_quota.h	2005/01/04 10:07:09	1.2
+++ cluster/gfs/gfs_quota/gfs_quota.h	2007/01/10 17:53:54	1.2.2.1
@@ -101,4 +101,7 @@
 uint32_t name_to_id(int user, char *name, int numbers);
 char *id_to_name(int user, uint32_t id, int numbers);
 
+/* layout.c */
+
+void print_quota_file(commandline_t *comline);
 #endif /* __GFS_QUOTA_DOT_H__ */



             reply	other threads:[~2007-01-10 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 17:53 adas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-04 21:31 [Cluster-devel] cluster gfs-kernel/src/gfs/ioctl.c gfs/gfs_quo adas
2007-04-20 10:48 ` Fabio Massimo Di Nitto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070110175355.3541.qmail@sourceware.org \
    --to=adas@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.