Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12f33891 authored by Artem Bityutskiy's avatar Artem Bityutskiy
Browse files

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: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 7703f09d
Loading
Loading
Loading
Loading
+8 −9
Original line number Original line Diff line number Diff line
@@ -573,7 +573,7 @@ int ubifs_bg_wbufs_sync(struct ubifs_info *c)
int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
{
{
	struct ubifs_info *c = wbuf->c;
	struct ubifs_info *c = wbuf->c;
	int err, written, n, aligned_len = ALIGN(len, 8), offs;
	int err, written, n, aligned_len = ALIGN(len, 8);


	dbg_io("%d bytes (%s) to jhead %s wbuf at LEB %d:%d", len,
	dbg_io("%d bytes (%s) to jhead %s wbuf at LEB %d:%d", len,
	       dbg_ntype(((struct ubifs_ch *)buf)->node_type),
	       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)
		goto exit;
		goto exit;
	}
	}


	offs = wbuf->offs;
	written = 0;
	written = 0;


	if (wbuf->used) {
	if (wbuf->used) {
@@ -653,7 +652,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
		if (err)
		if (err)
			goto out;
			goto out;


		offs += wbuf->size;
		wbuf->offs += wbuf->size;
		len -= wbuf->avail;
		len -= wbuf->avail;
		aligned_len -= wbuf->avail;
		aligned_len -= wbuf->avail;
		written += wbuf->avail;
		written += wbuf->avail;
@@ -672,7 +671,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
		if (err)
		if (err)
			goto out;
			goto out;


		offs += wbuf->size;
		wbuf->offs += wbuf->size;
		len -= wbuf->size;
		len -= wbuf->size;
		aligned_len -= wbuf->size;
		aligned_len -= wbuf->size;
		written += wbuf->size;
		written += wbuf->size;
@@ -687,12 +686,13 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
	n = aligned_len >> c->max_write_shift;
	n = aligned_len >> c->max_write_shift;
	if (n) {
	if (n) {
		n <<= c->max_write_shift;
		n <<= c->max_write_shift;
		dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, offs);
		dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum,
		err = ubi_leb_write(c->ubi, wbuf->lnum, buf + written, offs, n,
		       wbuf->offs);
				    wbuf->dtype);
		err = ubi_leb_write(c->ubi, wbuf->lnum, buf + written,
				    wbuf->offs, n, wbuf->dtype);
		if (err)
		if (err)
			goto out;
			goto out;
		offs += n;
		wbuf->offs += n;
		aligned_len -= n;
		aligned_len -= n;
		len -= n;
		len -= n;
		written += n;
		written += n;
@@ -707,7 +707,6 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
		 */
		 */
		memcpy(wbuf->buf, buf + written, len);
		memcpy(wbuf->buf, buf + written, len);


	wbuf->offs = offs;
	if (c->leb_size - wbuf->offs >= c->max_write_size)
	if (c->leb_size - wbuf->offs >= c->max_write_size)
		wbuf->size = c->max_write_size;
		wbuf->size = c->max_write_size;
	else
	else