linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH 08/30] UBIFS: remove dead code
Date: Thu,  9 Jun 2011 12:04:48 +0300	[thread overview]
Message-ID: <1307610310-28691-9-git-send-email-dedekind1@gmail.com> (raw)
In-Reply-To: <1307610310-28691-1-git-send-email-dedekind1@gmail.com>

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Remove dead pieces of code under "if (c->min_io_size == 1)" statement -
we never execute it because in UBIFS 'c->min_io_size' is always at least 8.
This are leftovers from old pre-mainline prototype.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 fs/ubifs/tnc_commit.c |  106 ++++++++++++++-----------------------------------
 1 files changed, 30 insertions(+), 76 deletions(-)

diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 41920f3..8315387 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -491,25 +491,6 @@ static int layout_in_empty_space(struct ubifs_info *c)
 		else
 			next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
 
-		if (c->min_io_size == 1) {
-			buf_offs += ALIGN(len, 8);
-			if (next_len) {
-				if (buf_offs + next_len <= c->leb_size)
-					continue;
-				err = ubifs_update_one_lp(c, lnum, 0,
-						c->leb_size - buf_offs, 0, 0);
-				if (err)
-					return err;
-				lnum = -1;
-				continue;
-			}
-			err = ubifs_update_one_lp(c, lnum,
-					c->leb_size - buf_offs, 0, 0, 0);
-			if (err)
-				return err;
-			break;
-		}
-
 		/* Update buffer positions */
 		wlen = used + len;
 		used += ALIGN(len, 8);
@@ -830,7 +811,7 @@ static int write_index(struct ubifs_info *c)
 	struct ubifs_idx_node *idx;
 	struct ubifs_znode *znode, *cnext;
 	int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
-	int avail, wlen, err, lnum_pos = 0;
+	int avail, wlen, err, lnum_pos = 0, blen, nxt_offs;
 
 	cnext = c->enext;
 	if (!cnext)
@@ -938,65 +919,38 @@ static int write_index(struct ubifs_info *c)
 		else
 			next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
 
-		if (c->min_io_size == 1) {
-			/*
-			 * Write the prepared index node immediately if there is
-			 * no minimum IO size
-			 */
-			err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs,
-					      wlen, UBI_SHORTTERM);
-			if (err)
-				return err;
-			buf_offs += ALIGN(wlen, 8);
-			if (next_len) {
-				used = 0;
-				avail = buf_len;
-				if (buf_offs + next_len > c->leb_size) {
-					err = ubifs_update_one_lp(c, lnum,
-						LPROPS_NC, 0, 0, LPROPS_TAKEN);
-					if (err)
-						return err;
-					lnum = -1;
-				}
+		nxt_offs = buf_offs + used + next_len;
+		if (next_len && nxt_offs <= c->leb_size) {
+			if (avail > 0)
 				continue;
-			}
+			else
+				blen = buf_len;
 		} else {
-			int blen, nxt_offs = buf_offs + used + next_len;
-
-			if (next_len && nxt_offs <= c->leb_size) {
-				if (avail > 0)
-					continue;
-				else
-					blen = buf_len;
-			} else {
-				wlen = ALIGN(wlen, 8);
-				blen = ALIGN(wlen, c->min_io_size);
-				ubifs_pad(c, c->cbuf + wlen, blen - wlen);
-			}
-			/*
-			 * The buffer is full or there are no more znodes
-			 * to do
-			 */
-			err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs,
-					      blen, UBI_SHORTTERM);
-			if (err)
-				return err;
-			buf_offs += blen;
-			if (next_len) {
-				if (nxt_offs > c->leb_size) {
-					err = ubifs_update_one_lp(c, lnum,
-						LPROPS_NC, 0, 0, LPROPS_TAKEN);
-					if (err)
-						return err;
-					lnum = -1;
-				}
-				used -= blen;
-				if (used < 0)
-					used = 0;
-				avail = buf_len - used;
-				memmove(c->cbuf, c->cbuf + blen, used);
-				continue;
+			wlen = ALIGN(wlen, 8);
+			blen = ALIGN(wlen, c->min_io_size);
+			ubifs_pad(c, c->cbuf + wlen, blen - wlen);
+		}
+
+		/* The buffer is full or there are no more znodes to do */
+		err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen,
+				      UBI_SHORTTERM);
+		if (err)
+			return err;
+		buf_offs += blen;
+		if (next_len) {
+			if (nxt_offs > c->leb_size) {
+				err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0,
+							  0, LPROPS_TAKEN);
+				if (err)
+					return err;
+				lnum = -1;
 			}
+			used -= blen;
+			if (used < 0)
+				used = 0;
+			avail = buf_len - used;
+			memmove(c->cbuf, c->cbuf + blen, used);
+			continue;
 		}
 		break;
 	}
-- 
1.7.2.3

  parent reply	other threads:[~2011-06-09  9:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  9:04 [PATCH 00/30] UBIFS: latest patches Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 01/30] UBIFS: return EROFS in case of broken commit Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 02/30] UBIFS: lessen the size of debugging info data structure Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 03/30] UBIFS: dump stack when pnode or nnode reading fails Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 04/30] UBIFS: improve inode dumping function Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 05/30] UBIFS: rename dbg_check_dir_size function Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 06/30] UBIFS: minor cleanup: use S_ISREG helper Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 07/30] UBIFS: remove unnecessary brackets Artem Bityutskiy
2011-06-09  9:04 ` Artem Bityutskiy [this message]
2011-06-09  9:04 ` [PATCH 09/30] UBIFS: harmonize znode flag helpers Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 10/30] UBIFS: use correct flags in lprops Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 11/30] UBIFS: add few commentaries about TNC Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 12/30] UBIFS: amend debugging name check function prototype Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 13/30] UBIFS: amend debugging inode size " Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 14/30] UBIFS: introduce helper functions for debugging checks and tests Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 15/30] UBIFS: lessen amount of debugging check types Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 16/30] UBIFS: switch self-check knobs to debugfs Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 17/30] UBIFS: be more informative in failure mode Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 18/30] UBIFS: re-arrange debugging code a bit Artem Bityutskiy
2011-06-09  9:04 ` [PATCH 19/30] UBIFS: introduce debugfs helpers Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 20/30] UBIFS: add global debugfs knobs Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 21/30] UBIFS: remove unused and unneeded debugging function Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 22/30] UBIFS: always print stacktrace when switching to R/O mode Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 23/30] UBIFS: introduce more I/O helpers Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 24/30] UBIFS: switch to ubifs_leb_read Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 25/30] UBIFS: switch to ubifs_leb_write Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 26/30] UBIFS: switch to I/O helpers Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 27/30] UBIFS: stop re-defining UBI operations Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 28/30] UBIFS: remove custom list of superblocks Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 29/30] UBIFS: rename recovery testing variables Artem Bityutskiy
2011-06-09  9:05 ` [PATCH 30/30] UBIFS: improve power cut emulation testing Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307610310-28691-9-git-send-email-dedekind1@gmail.com \
    --to=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).