aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/quota_v1.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-01-27 09:47:22 -0500
committerJan Kara <jack@suse.cz>2009-03-25 21:18:38 -0400
commit268157ba673e2a868c167211e39fcad4ada5fd1e (patch)
treed6747ab0c15cd0f9daf986f6e749a56d062e1e7f /fs/quota/quota_v1.c
parent7a2435d874388271cfe5046d180751352a1d30a2 (diff)
quota: Coding style fixes
Wrap long lines, remove assignments from conditions, rewrite two overcomplicated for loops. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota/quota_v1.c')
-rw-r--r--fs/quota/quota_v1.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index b4af1c69ad16..0edcf42b1778 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -62,11 +62,14 @@ static int v1_read_dqblk(struct dquot *dquot)
62 62
63 /* Set structure to 0s in case read fails/is after end of file */ 63 /* Set structure to 0s in case read fails/is after end of file */
64 memset(&dqblk, 0, sizeof(struct v1_disk_dqblk)); 64 memset(&dqblk, 0, sizeof(struct v1_disk_dqblk));
65 dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type, (char *)&dqblk, sizeof(struct v1_disk_dqblk), v1_dqoff(dquot->dq_id)); 65 dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type, (char *)&dqblk,
66 sizeof(struct v1_disk_dqblk), v1_dqoff(dquot->dq_id));
66 67
67 v1_disk2mem_dqblk(&dquot->dq_dqb, &dqblk); 68 v1_disk2mem_dqblk(&dquot->dq_dqb, &dqblk);
68 if (dquot->dq_dqb.dqb_bhardlimit == 0 && dquot->dq_dqb.dqb_bsoftlimit == 0 && 69 if (dquot->dq_dqb.dqb_bhardlimit == 0 &&
69 dquot->dq_dqb.dqb_ihardlimit == 0 && dquot->dq_dqb.dqb_isoftlimit == 0) 70 dquot->dq_dqb.dqb_bsoftlimit == 0 &&
71 dquot->dq_dqb.dqb_ihardlimit == 0 &&
72 dquot->dq_dqb.dqb_isoftlimit == 0)
70 set_bit(DQ_FAKE_B, &dquot->dq_flags); 73 set_bit(DQ_FAKE_B, &dquot->dq_flags);
71 dqstats.reads++; 74 dqstats.reads++;
72 75
@@ -81,13 +84,16 @@ static int v1_commit_dqblk(struct dquot *dquot)
81 84
82 v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb); 85 v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb);
83 if (dquot->dq_id == 0) { 86 if (dquot->dq_id == 0) {
84 dqblk.dqb_btime = sb_dqopt(dquot->dq_sb)->info[type].dqi_bgrace; 87 dqblk.dqb_btime =
85 dqblk.dqb_itime = sb_dqopt(dquot->dq_sb)->info[type].dqi_igrace; 88 sb_dqopt(dquot->dq_sb)->info[type].dqi_bgrace;
89 dqblk.dqb_itime =
90 sb_dqopt(dquot->dq_sb)->info[type].dqi_igrace;
86 } 91 }
87 ret = 0; 92 ret = 0;
88 if (sb_dqopt(dquot->dq_sb)->files[type]) 93 if (sb_dqopt(dquot->dq_sb)->files[type])
89 ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type, (char *)&dqblk, 94 ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
90 sizeof(struct v1_disk_dqblk), v1_dqoff(dquot->dq_id)); 95 (char *)&dqblk, sizeof(struct v1_disk_dqblk),
96 v1_dqoff(dquot->dq_id));
91 if (ret != sizeof(struct v1_disk_dqblk)) { 97 if (ret != sizeof(struct v1_disk_dqblk)) {
92 printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", 98 printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
93 dquot->dq_sb->s_id); 99 dquot->dq_sb->s_id);
@@ -130,15 +136,20 @@ static int v1_check_quota_file(struct super_block *sb, int type)
130 return 0; 136 return 0;
131 blocks = isize >> BLOCK_SIZE_BITS; 137 blocks = isize >> BLOCK_SIZE_BITS;
132 off = isize & (BLOCK_SIZE - 1); 138 off = isize & (BLOCK_SIZE - 1);
133 if ((blocks % sizeof(struct v1_disk_dqblk) * BLOCK_SIZE + off) % sizeof(struct v1_disk_dqblk)) 139 if ((blocks % sizeof(struct v1_disk_dqblk) * BLOCK_SIZE + off) %
140 sizeof(struct v1_disk_dqblk))
134 return 0; 141 return 0;
135 /* Doublecheck whether we didn't get file with new format - with old quotactl() this could happen */ 142 /* Doublecheck whether we didn't get file with new format - with old
136 size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0); 143 * quotactl() this could happen */
144 size = sb->s_op->quota_read(sb, type, (char *)&dqhead,
145 sizeof(struct v2_disk_dqheader), 0);
137 if (size != sizeof(struct v2_disk_dqheader)) 146 if (size != sizeof(struct v2_disk_dqheader))
138 return 1; /* Probably not new format */ 147 return 1; /* Probably not new format */
139 if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type]) 148 if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type])
140 return 1; /* Definitely not new format */ 149 return 1; /* Definitely not new format */
141 printk(KERN_INFO "VFS: %s: Refusing to turn on old quota format on given file. It probably contains newer quota format.\n", sb->s_id); 150 printk(KERN_INFO
151 "VFS: %s: Refusing to turn on old quota format on given file."
152 " It probably contains newer quota format.\n", sb->s_id);
142 return 0; /* Seems like a new format file -> refuse it */ 153 return 0; /* Seems like a new format file -> refuse it */
143} 154}
144 155
@@ -148,7 +159,9 @@ static int v1_read_file_info(struct super_block *sb, int type)
148 struct v1_disk_dqblk dqblk; 159 struct v1_disk_dqblk dqblk;
149 int ret; 160 int ret;
150 161
151 if ((ret = sb->s_op->quota_read(sb, type, (char *)&dqblk, sizeof(struct v1_disk_dqblk), v1_dqoff(0))) != sizeof(struct v1_disk_dqblk)) { 162 ret = sb->s_op->quota_read(sb, type, (char *)&dqblk,
163 sizeof(struct v1_disk_dqblk), v1_dqoff(0));
164 if (ret != sizeof(struct v1_disk_dqblk)) {
152 if (ret >= 0) 165 if (ret >= 0)
153 ret = -EIO; 166 ret = -EIO;
154 goto out; 167 goto out;
@@ -157,8 +170,10 @@ static int v1_read_file_info(struct super_block *sb, int type)
157 /* limits are stored as unsigned 32-bit data */ 170 /* limits are stored as unsigned 32-bit data */
158 dqopt->info[type].dqi_maxblimit = 0xffffffff; 171 dqopt->info[type].dqi_maxblimit = 0xffffffff;
159 dqopt->info[type].dqi_maxilimit = 0xffffffff; 172 dqopt->info[type].dqi_maxilimit = 0xffffffff;
160 dqopt->info[type].dqi_igrace = dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME; 173 dqopt->info[type].dqi_igrace =
161 dqopt->info[type].dqi_bgrace = dqblk.dqb_btime ? dqblk.dqb_btime : MAX_DQ_TIME; 174 dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME;
175 dqopt->info[type].dqi_bgrace =
176 dqblk.dqb_btime ? dqblk.dqb_btime : MAX_DQ_TIME;
162out: 177out:
163 return ret; 178 return ret;
164} 179}
@@ -170,8 +185,9 @@ static int v1_write_file_info(struct super_block *sb, int type)
170 int ret; 185 int ret;
171 186
172 dqopt->info[type].dqi_flags &= ~DQF_INFO_DIRTY; 187 dqopt->info[type].dqi_flags &= ~DQF_INFO_DIRTY;
173 if ((ret = sb->s_op->quota_read(sb, type, (char *)&dqblk, 188 ret = sb->s_op->quota_read(sb, type, (char *)&dqblk,
174 sizeof(struct v1_disk_dqblk), v1_dqoff(0))) != sizeof(struct v1_disk_dqblk)) { 189 sizeof(struct v1_disk_dqblk), v1_dqoff(0));
190 if (ret != sizeof(struct v1_disk_dqblk)) {
175 if (ret >= 0) 191 if (ret >= 0)
176 ret = -EIO; 192 ret = -EIO;
177 goto out; 193 goto out;