diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-02 12:39:19 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-02 12:39:19 -0400 |
commit | 48516ced21e83a755ebae3d1ed03f1731befc391 (patch) | |
tree | 9cf3c78506056d36909ce8da5560162d4c0fbc17 /fs/gfs2/ops_address.c | |
parent | 3cf1e7bed4681bdb1c14b6e146ae9c0afb6c1552 (diff) |
[GFS2] Remove uneeded endian conversion
In many places GFS2 was calling the endian conversion routines
for an inode even when only a single field, or a few fields might
have changed. As a result we were copying lots of data needlessly.
This patch replaces those calls with conversion of just the
required fields in each case. This should be faster and easier
to understand. There are still other places which suffer from this
problem, but this is a start in the right direction.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r-- | fs/gfs2/ops_address.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 811f4ada2a01..4fb743f4e4a4 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -460,7 +460,8 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
460 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 460 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
461 | int error = -EOPNOTSUPP; | 461 | int error = -EOPNOTSUPP; |
462 | struct buffer_head *dibh; | 462 | struct buffer_head *dibh; |
463 | struct gfs2_alloc *al = &ip->i_alloc;; | 463 | struct gfs2_alloc *al = &ip->i_alloc; |
464 | struct gfs2_dinode *di; | ||
464 | 465 | ||
465 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl))) | 466 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl))) |
466 | goto fail_nounlock; | 467 | goto fail_nounlock; |
@@ -470,6 +471,7 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
470 | goto fail_endtrans; | 471 | goto fail_endtrans; |
471 | 472 | ||
472 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 473 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
474 | di = (struct gfs2_dinode *)dibh->b_data; | ||
473 | 475 | ||
474 | if (gfs2_is_stuffed(ip)) { | 476 | if (gfs2_is_stuffed(ip)) { |
475 | u64 file_size; | 477 | u64 file_size; |
@@ -495,10 +497,16 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
495 | goto fail; | 497 | goto fail; |
496 | } | 498 | } |
497 | 499 | ||
498 | if (ip->i_di.di_size < inode->i_size) | 500 | if (ip->i_di.di_size < inode->i_size) { |
499 | ip->i_di.di_size = inode->i_size; | 501 | ip->i_di.di_size = inode->i_size; |
502 | di->di_size = cpu_to_be64(inode->i_size); | ||
503 | } | ||
504 | |||
505 | di->di_mode = cpu_to_be32(inode->i_mode); | ||
506 | di->di_atime = cpu_to_be64(inode->i_atime.tv_sec); | ||
507 | di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec); | ||
508 | di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec); | ||
500 | 509 | ||
501 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | ||
502 | brelse(dibh); | 510 | brelse(dibh); |
503 | gfs2_trans_end(sdp); | 511 | gfs2_trans_end(sdp); |
504 | if (al->al_requested) { | 512 | if (al->al_requested) { |