diff mbox

os/FileJournal: Update the journal header when closing journal

Message ID 6AA21C22F0A5DA478922644AD2EC308C895E17@SHSMSX101.ccr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ma, Jianpeng July 23, 2014, 7:43 a.m. UTC
When closing journal, it should check must_write_header and update
journal header if must_write_header alreay set.
It can reduce the nosense journal-replay after restarting osd.

Signed-off-by: Ma Jianpeng <jianpeng.ma@intel.com>
---
 src/os/FileJournal.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sage Weil July 23, 2014, 5:38 p.m. UTC | #1
Hi,

Pushed this to wip-journal-header, see

	https://github.com/ceph/ceph/pull/2139

We'll run this through the regression suite before merging.

Thanks!
sage


On Wed, 23 Jul 2014, Ma, Jianpeng wrote:

> When closing journal, it should check must_write_header and update
> journal header if must_write_header alreay set.
> It can reduce the nosense journal-replay after restarting osd.
> 
> Signed-off-by: Ma Jianpeng <jianpeng.ma@intel.com>
> ---
>  src/os/FileJournal.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc
> index 7eb7927..5649e6d 100644
> --- a/src/os/FileJournal.cc
> +++ b/src/os/FileJournal.cc
> @@ -544,6 +544,7 @@ void FileJournal::close()
> 
>    // close
>    assert(writeq_empty());
> +  assert(!must_write_header);
>    assert(fd >= 0);
>    VOID_TEMP_FAILURE_RETRY(::close(fd));
>    fd = -1;
> @@ -1102,7 +1103,7 @@ void FileJournal::write_thread_entry()
>    while (1) {
>      {
>        Mutex::Locker locker(writeq_lock);
> -      if (writeq.empty()) {
> +      if (writeq.empty() && !must_write_header) {
>         if (write_stop)
>           break;
>         dout(20) << "write_thread_entry going to sleep" << dendl;
> --
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc
index 7eb7927..5649e6d 100644
--- a/src/os/FileJournal.cc
+++ b/src/os/FileJournal.cc
@@ -544,6 +544,7 @@  void FileJournal::close()

   // close
   assert(writeq_empty());
+  assert(!must_write_header);
   assert(fd >= 0);
   VOID_TEMP_FAILURE_RETRY(::close(fd));
   fd = -1;
@@ -1102,7 +1103,7 @@  void FileJournal::write_thread_entry()
   while (1) {
     {
       Mutex::Locker locker(writeq_lock);
-      if (writeq.empty()) {
+      if (writeq.empty() && !must_write_header) {
        if (write_stop)
          break;
        dout(20) << "write_thread_entry going to sleep" << dendl;