From febe80f4bb2bcb3c612c102c1c2395b43989f5ca Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Wed, 30 Sep 2015 08:00:00 +0800 Subject: [PATCH 1/6] [damage_visitor] update path_tracker in error_accessing_node() --- persistent-data/data-structures/btree_damage_visitor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/persistent-data/data-structures/btree_damage_visitor.h b/persistent-data/data-structures/btree_damage_visitor.h index 2e248e8..fa11378 100644 --- a/persistent-data/data-structures/btree_damage_visitor.h +++ b/persistent-data/data-structures/btree_damage_visitor.h @@ -197,6 +197,7 @@ namespace persistent_data { error_outcome error_accessing_node(node_location const &l, block_address b, std::string const &what) { + update_path(l.path); report_damage(what); return btree::visitor::EXCEPTION_HANDLED; } From 77f803c52896831a319fb750f2a2f982a52db924 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Thu, 26 Nov 2015 15:00:00 +0800 Subject: [PATCH 2/6] [build] Support external strip command --- Makefile.in | 4 +++- configure.ac | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index e67b300..003cb3d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,6 +93,7 @@ SOURCE=\ CC:=@CC@ CXX:=@CXX@ +STRIP:=@STRIP@ OBJECTS:=$(subst .cc,.o,$(SOURCE)) TOP_DIR:=@top_srcdir@ TOP_BUILDDIR:=@top_builddir@ @@ -112,7 +113,7 @@ MANPATH:=$(DATADIR)/man vpath %.cc $(TOP_DIR) INSTALL_DIR = $(INSTALL) -m 755 -d -INSTALL_PROGRAM = $(INSTALL) -m 755 -s +INSTALL_PROGRAM = $(INSTALL) -m 755 INSTALL_DATA = $(INSTALL) -p -m 644 ifeq ("@TESTING@", "yes") @@ -165,6 +166,7 @@ distclean: clean install: bin/pdata_tools $(INSTALL_DIR) $(BINDIR) $(INSTALL_PROGRAM) bin/pdata_tools $(BINDIR) + $(STRIP) $(BINDIR)/pdata_tools ln -s -f pdata_tools $(BINDIR)/cache_check ln -s -f pdata_tools $(BINDIR)/cache_dump ln -s -f pdata_tools $(BINDIR)/cache_metadata_size diff --git a/configure.ac b/configure.ac index 3e6c6a9..f5e7a2e 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,9 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_MKDIR_P AC_PROG_INSTALL +AC_DEFUN([AC_PROG_STRIP], [AC_CHECK_TOOL(STRIP, strip, :)]) +AC_PROG_STRIP +AC_ARG_VAR(STRIP, [Command for discarding symbols from object files]) ################################################################ dnl -- Checks for functions. From 03590d3c915f0821852e45f981b5c65d64c0c7c3 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Fri, 27 Nov 2015 23:38:27 +0800 Subject: [PATCH 3/6] Fix bug in superblock UUID string copy --- thin-provisioning/restore_emitter.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/thin-provisioning/restore_emitter.cc b/thin-provisioning/restore_emitter.cc index 5fae879..fd83f56 100644 --- a/thin-provisioning/restore_emitter.cc +++ b/thin-provisioning/restore_emitter.cc @@ -50,7 +50,8 @@ namespace { in_superblock_ = true; nr_data_blocks_ = nr_data_blocks; superblock &sb = md_->sb_; - memcpy(&sb.uuid_, &uuid, sizeof(sb.uuid_)); + memset(&sb.uuid_, 0, sizeof(sb.uuid_)); + memcpy(&sb.uuid_, uuid.c_str(), std::min(sizeof(sb.uuid_), uuid.length())); sb.time_ = time; sb.trans_id_ = trans_id; sb.data_block_size_ = data_block_size; From 856bd95d8e2d4a2d7e89e9b367d87a1c534af17e Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Fri, 27 Nov 2015 23:38:37 +0800 Subject: [PATCH 4/6] Fix the unit of superblock::metadata_block_size_ to be sector-based --- thin-provisioning/metadata.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/metadata.cc b/thin-provisioning/metadata.cc index aa29f78..e3db414 100644 --- a/thin-provisioning/metadata.cc +++ b/thin-provisioning/metadata.cc @@ -109,7 +109,7 @@ metadata::metadata(std::string const &dev_path, open_type ot, sb_.data_mapping_root_ = mappings_->get_root(); sb_.device_details_root_ = details_->get_root(); sb_.data_block_size_ = data_block_size; - sb_.metadata_block_size_ = MD_BLOCK_SIZE; + sb_.metadata_block_size_ = MD_BLOCK_SIZE >> SECTOR_SHIFT; sb_.metadata_nr_blocks_ = tm_->get_bm()->get_nr_blocks(); break; @@ -177,7 +177,7 @@ metadata::metadata(block_manager<>::ptr bm, open_type ot, sb_.data_mapping_root_ = mappings_->get_root(); sb_.device_details_root_ = details_->get_root(); sb_.data_block_size_ = data_block_size; - sb_.metadata_block_size_ = MD_BLOCK_SIZE; + sb_.metadata_block_size_ = MD_BLOCK_SIZE >> SECTOR_SHIFT; sb_.metadata_nr_blocks_ = tm_->get_bm()->get_nr_blocks(); break; From e528fa197258081d02b187b4b3b61894dc5d2e48 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Fri, 27 Nov 2015 23:38:42 +0800 Subject: [PATCH 5/6] Add BLKDISCARD definition --- thin-provisioning/thin_trim.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thin-provisioning/thin_trim.cc b/thin-provisioning/thin_trim.cc index 0118b62..38a95f2 100644 --- a/thin-provisioning/thin_trim.cc +++ b/thin-provisioning/thin_trim.cc @@ -6,6 +6,10 @@ #undef BLOCK_SIZE +#ifndef BLKDISCARD +#define BLKDISCARD _IO(0x12,119) +#endif + #include "thin-provisioning/commands.h" #include "metadata.h" #include "version.h" From 3be4fe985f5b8084bcbc2180df4abcda5a608757 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Fri, 27 Nov 2015 23:38:55 +0800 Subject: [PATCH 6/6] [build] Add AC_SYS_LARGEFILE to check for large-file support To use off64_t on 32-bit system --- Makefile.in | 2 ++ configure.ac | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/Makefile.in b/Makefile.in index 003cb3d..ac2a2f4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -98,10 +98,12 @@ OBJECTS:=$(subst .cc,.o,$(SOURCE)) TOP_DIR:=@top_srcdir@ TOP_BUILDDIR:=@top_builddir@ CFLAGS+=-g -Wall -O3 +CFLAGS+=@LFS_FLAGS@ CXXFLAGS+=-g -Wall -fno-strict-aliasing CXXFLAGS+=@CXXOPTIMISE_FLAG@ CXXFLAGS+=@CXXDEBUG_FLAG@ CXXFLAGS+=@CXX_STRERROR_FLAG@ +CXXFLAGS+=@LFS_FLAGS@ INCLUDES+=-I$(TOP_BUILDDIR) -I$(TOP_DIR) -I$(TOP_DIR)/thin-provisioning LIBS:=-lstdc++ -laio -lexpat INSTALL:=@INSTALL@ diff --git a/configure.ac b/configure.ac index f5e7a2e..5de0fe4 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,16 @@ AC_DEFUN([AC_PROG_STRIP], [AC_CHECK_TOOL(STRIP, strip, :)]) AC_PROG_STRIP AC_ARG_VAR(STRIP, [Command for discarding symbols from object files]) +################################################################ +dnl -- Check for large file support +AC_SYS_LARGEFILE +if test x$ac_cv_sys_file_offset_bits = x64; then + LFS_FLAGS+="-D_FILE_OFFSET_BITS=64" +fi +if test x$ac_cv_sys_large_files = x1; then + LFS_FLAGS+="-D_LARGE_FILES" +fi + ################################################################ dnl -- Checks for functions. AC_FUNC_STRERROR_R @@ -147,6 +157,7 @@ VERSION_PATCHLEVEL=`echo "$VER" | $AWK -F '[[(.]]' '{print $3}'` AC_SUBST(CXXDEBUG_FLAG) AC_SUBST(CXXOPTIMISE_FLAG) AC_SUBST(CXX_STRERROR_FLAG) +AC_SUBST(LFS_FLAGS) AC_SUBST(INSTALL) AC_SUBST(prefix) AC_SUBST(RELEASE_DATE)