aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-02-27 12:00:42 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-27 12:00:42 -0500
commit568f4c9659a2225b0d29cf86feecbcf25c9045c8 (patch)
tree8ec0fee12313f88a195e0b90924f6b7633ba29f1 /fs/gfs2/dir.c
parent3a8fe9be6c9794e55ac2253eab91d42b28a9dab6 (diff)
[GFS2] 80 Column audit of GFS2
Requested by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 65871a2b460e..56683788a6cf 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -98,7 +98,8 @@ int gfs2_dir_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
98 gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD); 98 gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD);
99 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); 99 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
100 } else { 100 } else {
101 error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT, &bh); 101 error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT,
102 &bh);
102 if (error) 103 if (error)
103 return error; 104 return error;
104 if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_JD)) { 105 if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_JD)) {
@@ -163,7 +164,8 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
163 164
164 if (gfs2_is_stuffed(ip) && 165 if (gfs2_is_stuffed(ip) &&
165 offset + size <= sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) 166 offset + size <= sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode))
166 return gfs2_dir_write_stuffed(ip, buf, (unsigned int)offset, size); 167 return gfs2_dir_write_stuffed(ip, buf, (unsigned int)offset,
168 size);
167 169
168 if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip))) 170 if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip)))
169 return -EINVAL; 171 return -EINVAL;
@@ -188,7 +190,8 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
188 190
189 if (!extlen) { 191 if (!extlen) {
190 new = 1; 192 new = 1;
191 error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen); 193 error = gfs2_block_map(ip, lblock, &new, &dblock,
194 &extlen);
192 if (error) 195 if (error)
193 goto fail; 196 goto fail;
194 error = -EIO; 197 error = -EIO;
@@ -196,7 +199,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
196 goto fail; 199 goto fail;
197 } 200 }
198 201
199 error = gfs2_dir_get_buffer(ip, dblock, (amount == sdp->sd_jbsize) ? 1 : new, &bh); 202 error = gfs2_dir_get_buffer(ip, dblock,
203 (amount == sdp->sd_jbsize) ?
204 1 : new, &bh);
200 if (error) 205 if (error)
201 goto fail; 206 goto fail;
202 207
@@ -280,7 +285,8 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
280 return 0; 285 return 0;
281 286
282 if (gfs2_is_stuffed(ip)) 287 if (gfs2_is_stuffed(ip))
283 return gfs2_dir_read_stuffed(ip, buf, (unsigned int)offset, size); 288 return gfs2_dir_read_stuffed(ip, buf, (unsigned int)offset,
289 size);
284 290
285 if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip))) 291 if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip)))
286 return -EINVAL; 292 return -EINVAL;
@@ -299,7 +305,8 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
299 305
300 if (!extlen) { 306 if (!extlen) {
301 new = 0; 307 new = 0;
302 error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen); 308 error = gfs2_block_map(ip, lblock, &new, &dblock,
309 &extlen);
303 if (error) 310 if (error)
304 goto fail; 311 goto fail;
305 } 312 }
@@ -538,13 +545,15 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,
538 545
539 if (dent->de_inum.no_addr) { 546 if (dent->de_inum.no_addr) {
540 new = (struct gfs2_dirent *)((char *)dent + 547 new = (struct gfs2_dirent *)((char *)dent +
541 GFS2_DIRENT_SIZE(cur_name_len)); 548 GFS2_DIRENT_SIZE(cur_name_len));
542 memset(new, 0, sizeof(struct gfs2_dirent)); 549 memset(new, 0, sizeof(struct gfs2_dirent));
543 550
544 new->de_rec_len = cpu_to_be16(cur_rec_len - GFS2_DIRENT_SIZE(cur_name_len)); 551 new->de_rec_len = cpu_to_be16(cur_rec_len -
552 GFS2_DIRENT_SIZE(cur_name_len));
545 new->de_name_len = cpu_to_be16(name_len); 553 new->de_name_len = cpu_to_be16(name_len);
546 554
547 dent->de_rec_len = cpu_to_be16(cur_rec_len - be16_to_cpu(new->de_rec_len)); 555 dent->de_rec_len = cpu_to_be16(cur_rec_len -
556 be16_to_cpu(new->de_rec_len));
548 557
549 *dent_out = new; 558 *dent_out = new;
550 return 0; 559 return 0;
@@ -2281,7 +2290,8 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
2281 error = gfs2_meta_inode_buffer(dip, &bh); 2290 error = gfs2_meta_inode_buffer(dip, &bh);
2282 if (!error) { 2291 if (!error) {
2283 gfs2_trans_add_bh(dip->i_gl, bh, 1); 2292 gfs2_trans_add_bh(dip->i_gl, bh, 1);
2284 ((struct gfs2_dinode *)bh->b_data)->di_mode = cpu_to_be32(S_IFREG); 2293 ((struct gfs2_dinode *)bh->b_data)->di_mode =
2294 cpu_to_be32(S_IFREG);
2285 brelse(bh); 2295 brelse(bh);
2286 } 2296 }
2287 2297