[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster gfs-kernel/src/gfs/ioctl.c gfs/gfs_quo ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	adas 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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]