aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/io.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-14 10:37:47 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 03:31:40 -0400
commit12f338914e7f2a9ab0def09564b9e78ab45a474f (patch)
tree58730ff8615d2a82fc52566cb235ce053437c0f1 /fs/ubifs/io.c
parent7703f09ded1b8719d2defe0f61215b4a08702ffa (diff)
UBIFS: remove unnecessary stack variable
This is patch removes an unnecessary 'offs' variable from 'ubifs_wbuf_write_nolock()' - we can just keep 'wbuf->offs' up-to-date instead. This patch is very minor the only motivation for it was that it is cleaner to keep wbuf->offs up-to-date by the time we call 'ubifs_leb_write()'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/io.c')
-rw-r--r--fs/ubifs/io.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 6cc09311a632..67bbde3550cf 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -573,7 +573,7 @@ out_timers:
573int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) 573int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
574{ 574{
575 struct ubifs_info *c = wbuf->c; 575 struct ubifs_info *c = wbuf->c;
576 int err, written, n, aligned_len = ALIGN(len, 8), offs; 576 int err, written, n, aligned_len = ALIGN(len, 8);
577 577
578 dbg_io("%d bytes (%s) to jhead %s wbuf at LEB %d:%d", len, 578 dbg_io("%d bytes (%s) to jhead %s wbuf at LEB %d:%d", len,
579 dbg_ntype(((struct ubifs_ch *)buf)->node_type), 579 dbg_ntype(((struct ubifs_ch *)buf)->node_type),
@@ -636,7 +636,6 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
636 goto exit; 636 goto exit;
637 } 637 }
638 638
639 offs = wbuf->offs;
640 written = 0; 639 written = 0;
641 640
642 if (wbuf->used) { 641 if (wbuf->used) {
@@ -653,7 +652,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
653 if (err) 652 if (err)
654 goto out; 653 goto out;
655 654
656 offs += wbuf->size; 655 wbuf->offs += wbuf->size;
657 len -= wbuf->avail; 656 len -= wbuf->avail;
658 aligned_len -= wbuf->avail; 657 aligned_len -= wbuf->avail;
659 written += wbuf->avail; 658 written += wbuf->avail;
@@ -672,7 +671,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
672 if (err) 671 if (err)
673 goto out; 672 goto out;
674 673
675 offs += wbuf->size; 674 wbuf->offs += wbuf->size;
676 len -= wbuf->size; 675 len -= wbuf->size;
677 aligned_len -= wbuf->size; 676 aligned_len -= wbuf->size;
678 written += wbuf->size; 677 written += wbuf->size;
@@ -687,12 +686,13 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
687 n = aligned_len >> c->max_write_shift; 686 n = aligned_len >> c->max_write_shift;
688 if (n) { 687 if (n) {
689 n <<= c->max_write_shift; 688 n <<= c->max_write_shift;
690 dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, offs); 689 dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum,
691 err = ubi_leb_write(c->ubi, wbuf->lnum, buf + written, offs, n, 690 wbuf->offs);
692 wbuf->dtype); 691 err = ubi_leb_write(c->ubi, wbuf->lnum, buf + written,
692 wbuf->offs, n, wbuf->dtype);
693 if (err) 693 if (err)
694 goto out; 694 goto out;
695 offs += n; 695 wbuf->offs += n;
696 aligned_len -= n; 696 aligned_len -= n;
697 len -= n; 697 len -= n;
698 written += n; 698 written += n;
@@ -707,7 +707,6 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
707 */ 707 */
708 memcpy(wbuf->buf, buf + written, len); 708 memcpy(wbuf->buf, buf + written, len);
709 709
710 wbuf->offs = offs;
711 if (c->leb_size - wbuf->offs >= c->max_write_size) 710 if (c->leb_size - wbuf->offs >= c->max_write_size)
712 wbuf->size = c->max_write_size; 711 wbuf->size = c->max_write_size;
713 else 712 else