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

[Cluster-devel] [PATCH 2/2] GFS2: struct gfs2_quota conversion cleanup



*) Remove gfs2_quota_in(). Its only purpose in life is to convert disk-endian
   fields to cpu-endian only to see how they're converted back 5 lines below.
   Assign on-disk endian values directly.
*) Don't do

	char buf[sizeof(struct gfs2_quota)];

   use real structure.
*) gfs2_quota_out() doesn't exist, remove it's proto.

Also, this will help endian annotations by removing one structure that
otherwise would be forked.

Signed-off-by: Alexey Dobriyan <adobriyan gmail com>
---

 fs/gfs2/ondisk.c            |    9 ---------
 fs/gfs2/quota.c             |   12 +++++-------
 include/linux/gfs2_ondisk.h |    3 ---
 3 files changed, 5 insertions(+), 19 deletions(-)

--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -144,15 +144,6 @@ void gfs2_rgrp_out(const struct gfs2_rgr
 	memset(&str->rg_reserved, 0, sizeof(str->rg_reserved));
 }
 
-void gfs2_quota_in(struct gfs2_quota *qu, const void *buf)
-{
-	const struct gfs2_quota *str = buf;
-
-	qu->qu_limit = be64_to_cpu(str->qu_limit);
-	qu->qu_warn = be64_to_cpu(str->qu_warn);
-	qu->qu_value = be64_to_cpu(str->qu_value);
-}
-
 void gfs2_dinode_in(struct gfs2_dinode *di, const void *buf)
 {
 	const struct gfs2_dinode *str = buf;
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -744,7 +744,6 @@ static int do_glock(struct gfs2_quota_da
 	struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
 	struct gfs2_holder i_gh;
 	struct gfs2_quota q;
-	char buf[sizeof(struct gfs2_quota)];
 	struct file_ra_state ra_state;
 	int error;
 	struct gfs2_quota_lvb *qlvb;
@@ -770,9 +769,9 @@ restart:
 		if (error)
 			goto fail;
 
-		memset(buf, 0, sizeof(struct gfs2_quota));
+		memset(&q, 0, sizeof(struct gfs2_quota));
 		pos = qd2offset(qd);
-		error = gfs2_internal_read(ip, &ra_state, buf,
+		error = gfs2_internal_read(ip, &ra_state, (char *)&q,
 					   &pos, sizeof(struct gfs2_quota));
 		if (error < 0)
 			goto fail_gunlock;
@@ -780,13 +779,12 @@ restart:
 		gfs2_glock_dq_uninit(&i_gh);
 
 
-		gfs2_quota_in(&q, buf);
 		qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb;
 		qlvb->qb_magic = cpu_to_be32(GFS2_MAGIC);
 		qlvb->__pad = 0;
-		qlvb->qb_limit = cpu_to_be64(q.qu_limit);
-		qlvb->qb_warn = cpu_to_be64(q.qu_warn);
-		qlvb->qb_value = cpu_to_be64(q.qu_value);
+		qlvb->qb_limit = q.qu_limit;
+		qlvb->qb_warn = q.qu_warn;
+		qlvb->qb_value = q.qu_value;
 		qd->qd_qb = *qlvb;
 
 		if (gfs2_glock_is_blocking(qd->qd_gl)) {
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -420,8 +420,6 @@ extern void gfs2_rindex_in(struct gfs2_r
 extern void gfs2_rindex_out(const struct gfs2_rindex *ri, void *buf);
 extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, const void *buf);
 extern void gfs2_rgrp_out(const struct gfs2_rgrp *rg, void *buf);
-extern void gfs2_quota_in(struct gfs2_quota *qu, const void *buf);
-extern void gfs2_quota_out(const struct gfs2_quota *qu, void *buf);
 extern void gfs2_dinode_in(struct gfs2_dinode *di, const void *buf);
 extern void gfs2_dinode_out(const struct gfs2_dinode *di, void *buf);
 extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf);


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