mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Weinberger <rw@linutronix.de>
To: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	tim.bird@am.sony.com, dedekind1@gmail.com,
	Richard Weinberger <rw@linutronix.de>
Subject: [RFC][PATCH 3/7] MTD: UBI: Export next_sqnum()
Date: Tue, 14 Feb 2012 21:06:42 +0100	[thread overview]
Message-ID: <1329250006-22944-4-git-send-email-rw@linutronix.de> (raw)
In-Reply-To: <1329250006-22944-1-git-send-email-rw@linutronix.de>

The checkpointing subsystem needs to read the next sequence nummber
directly.

Signed-off-by: Richard Weinberger <rw@linutronix.de>
---
 drivers/mtd/ubi/eba.c |   18 +++++++++---------
 drivers/mtd/ubi/ubi.h |    1 +
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index cd26da8..4dae50c 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -57,7 +57,7 @@
  * global sequence counter value. It also increases the global sequence
  * counter.
  */
-static unsigned long long next_sqnum(struct ubi_device *ubi)
+unsigned long long ubi_next_sqnum(struct ubi_device *ubi)
 {
 	unsigned long long sqnum;
 
@@ -522,7 +522,7 @@ retry:
 		goto out_put;
 	}
 
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	err = ubi_io_write_vid_hdr(ubi, new_pnum, vid_hdr);
 	if (err)
 		goto write_error;
@@ -634,7 +634,7 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
 	}
 
 	vid_hdr->vol_type = UBI_VID_DYNAMIC;
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	vid_hdr->vol_id = cpu_to_be32(vol_id);
 	vid_hdr->lnum = cpu_to_be32(lnum);
 	vid_hdr->compat = ubi_get_compat(ubi, vol_id);
@@ -695,7 +695,7 @@ write_error:
 		return err;
 	}
 
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	ubi_msg("try another PEB");
 	goto retry;
 }
@@ -750,7 +750,7 @@ int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol,
 		return err;
 	}
 
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	vid_hdr->vol_id = cpu_to_be32(vol_id);
 	vid_hdr->lnum = cpu_to_be32(lnum);
 	vid_hdr->compat = ubi_get_compat(ubi, vol_id);
@@ -815,7 +815,7 @@ write_error:
 		return err;
 	}
 
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	ubi_msg("try another PEB");
 	goto retry;
 }
@@ -868,7 +868,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
 	if (err)
 		goto out_mutex;
 
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	vid_hdr->vol_id = cpu_to_be32(vol_id);
 	vid_hdr->lnum = cpu_to_be32(lnum);
 	vid_hdr->compat = ubi_get_compat(ubi, vol_id);
@@ -936,7 +936,7 @@ write_error:
 		goto out_leb_unlock;
 	}
 
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 	ubi_msg("try another PEB");
 	goto retry;
 }
@@ -1096,7 +1096,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
 		vid_hdr->data_size = cpu_to_be32(data_size);
 		vid_hdr->data_crc = cpu_to_be32(crc);
 	}
-	vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
+	vid_hdr->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
 
 	err = ubi_io_write_vid_hdr(ubi, to, vid_hdr);
 	if (err) {
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 4fe3638..b4dca54 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -557,6 +557,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
 int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
 		     struct ubi_vid_hdr *vid_hdr);
 int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si);
+unsigned long long ubi_next_sqnum(struct ubi_device *ubi);
 
 /* wl.c */
 int ubi_wl_get_peb(struct ubi_device *ubi, int dtype);
-- 
1.7.7


  parent reply	other threads:[~2012-02-14 20:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 20:06 [RFC][PATCH 0/7] UBI checkpointing support Richard Weinberger
2012-02-14 20:06 ` [RFC][PATCH 1/7] MTD: UBI: Add checkpoint on-chip layout Richard Weinberger
2012-03-07 16:09   ` Artem Bityutskiy
2012-03-07 21:02     ` Richard Weinberger
2012-03-07 22:09       ` Thomas Gleixner
2012-03-07 22:23         ` Thomas Gleixner
2012-02-14 20:06 ` [RFC][PATCH 2/7] MTD: UBI: Add checkpoint struct to ubi_device Richard Weinberger
2012-02-14 20:06 ` Richard Weinberger [this message]
2012-02-14 20:06 ` [RFC][PATCH 4/7] MTD: UBI: Make wl subsystem checkpoint aware Richard Weinberger
2012-02-14 20:06 ` [RFC][PATCH 5/7] MTD: UBI: Make process_eb() " Richard Weinberger
2012-02-14 20:06 ` [RFC][PATCH 6/7] MTD: UBI: Implement checkpointing support Richard Weinberger
2012-02-20 16:31   ` Shmulik Ladkani
2012-02-14 20:06 ` [RFC][PATCH 7/7] MTD: UBI: wire up checkpointing Richard Weinberger
2012-02-19 13:57   ` Shmulik Ladkani
2012-02-19 14:08     ` Richard Weinberger
2012-02-19 14:40       ` Shmulik Ladkani
2012-02-19 15:08         ` Richard Weinberger
2012-02-29 11:35 ` [RFC][PATCH 0/7] UBI checkpointing support Artem Bityutskiy
2012-02-29 11:36   ` Artem Bityutskiy
2012-02-29 11:40   ` Richard Weinberger
2012-02-29 12:01     ` Artem Bityutskiy
2012-02-29 12:09     ` Artem Bityutskiy
2012-03-07 16:04 ` Artem Bityutskiy
2012-03-07 21:01   ` Richard Weinberger
2012-03-08 11:22     ` Artem Bityutskiy
2012-03-07 16:33 ` Artem Bityutskiy
2012-03-07 21:19   ` Richard Weinberger
2012-03-08  7:08     ` Shmulik Ladkani
2012-03-08  9:21       ` Richard Weinberger
2012-03-08 11:58         ` Artem Bityutskiy
2012-03-08 13:16           ` Shmulik Ladkani
2012-03-08 11:54     ` 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=1329250006-22944-4-git-send-email-rw@linutronix.de \
    --to=rw@linutronix.de \
    --cc=dedekind1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tim.bird@am.sony.com \
    /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

all inboxes | Powered by JetHome®