Fix build errors due new gcc 10 default for -fno-common

This commit is contained in:
Andrea Mazzoleni 2020-05-18 15:21:42 +02:00
parent 2f9e0e6fdd
commit 5bac3d64a6
9 changed files with 34 additions and 17 deletions

View file

@ -1,8 +1,9 @@
SnapRAID HISTORY SnapRAID HISTORY
================ ================
11.4 2020/05 (WorkInProgress) 11.4 2020/05
============================= =============================
* Fix build errors due new gcc 10 default for -fno-common.
* In fixing, if a parity is filtered out, don't attempt to recover its size, * In fixing, if a parity is filtered out, don't attempt to recover its size,
and proceed without it if missing. and proceed without it if missing.
* Avoid unnecessary parity read when fixing the parity itself. * Avoid unnecessary parity read when fixing the parity itself.

View file

@ -19,6 +19,19 @@
#include "io.h" #include "io.h"
void (*io_start)(struct snapraid_io* io,
block_off_t blockstart, block_off_t blockmax,
int (*block_is_enabled)(void* arg, block_off_t), void* blockarg) = 0;
void (*io_stop)(struct snapraid_io* io) = 0;
block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer) = 0;
struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, unsigned* waiting_map, unsigned* waiting_mac) = 0;
struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac) = 0;
void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac) = 0;
void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip) = 0;
void (*io_write_next)(struct snapraid_io* io, block_off_t blockcur, int skip, int* writer_error) = 0;
void (*io_refresh)(struct snapraid_io* io) = 0;
/** /**
* Get the next block position to process. * Get the next block position to process.
*/ */

View file

@ -313,14 +313,14 @@ void io_done(struct snapraid_io* io);
/** /**
* Start all the worker threads. * Start all the worker threads.
*/ */
void (*io_start)(struct snapraid_io* io, extern void (*io_start)(struct snapraid_io* io,
block_off_t blockstart, block_off_t blockmax, block_off_t blockstart, block_off_t blockmax,
int (*block_is_enabled)(void* arg, block_off_t), void* blockarg); int (*block_is_enabled)(void* arg, block_off_t), void* blockarg);
/** /**
* Stop all the worker threads. * Stop all the worker threads.
*/ */
void (*io_stop)(struct snapraid_io* io); extern void (*io_stop)(struct snapraid_io* io);
/** /**
* Next read position. * Next read position.
@ -332,7 +332,7 @@ void (*io_stop)(struct snapraid_io* io);
* \param buffer The data buffers to use for this position. * \param buffer The data buffers to use for this position.
* \return The parity position. * \return The parity position.
*/ */
block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer); extern block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer);
/** /**
* Read a data block. * Read a data block.
@ -343,7 +343,7 @@ block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer);
* \param diskcur The position of the data block in the ::handle_map vector. * \param diskcur The position of the data block in the ::handle_map vector.
* \return The completed task. * \return The completed task.
*/ */
struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, unsigned* waiting_map, unsigned* waiting_mac); extern struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, unsigned* waiting_map, unsigned* waiting_mac);
/** /**
* Read a parity block. * Read a parity block.
@ -354,7 +354,7 @@ struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur,
* \param levcur The position of the parity block in the ::parity_handle_map vector. * \param levcur The position of the parity block in the ::parity_handle_map vector.
* \return The completed task. * \return The completed task.
*/ */
struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac); extern struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac);
/** /**
* Write of a parity block. * Write of a parity block.
@ -364,7 +364,7 @@ struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur
* \param io InputOutput context. * \param io InputOutput context.
* \param levcur The position of the parity block in the ::parity_handle_map vector. * \param levcur The position of the parity block in the ::parity_handle_map vector.
*/ */
void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac); extern void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac);
/** /**
* Preset the write position. * Preset the write position.
@ -376,7 +376,7 @@ void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* wait
* \param blockcur The parity position to write. * \param blockcur The parity position to write.
* \param skip Skip the writes, in case parity doesn't need to be updated. * \param skip Skip the writes, in case parity doesn't need to be updated.
*/ */
void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip); extern void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip);
/** /**
* Next write position. * Next write position.
@ -389,12 +389,12 @@ void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip);
* \param skip Skip the writes, in case parity doesn't need to be updated. * \param skip Skip the writes, in case parity doesn't need to be updated.
* \param writer_error Return the number of errors. Vector of IO_WRITER_ERROR_MAX elements. * \param writer_error Return the number of errors. Vector of IO_WRITER_ERROR_MAX elements.
*/ */
void (*io_write_next)(struct snapraid_io* io, block_off_t blockcur, int skip, int* writer_error); extern void (*io_write_next)(struct snapraid_io* io, block_off_t blockcur, int skip, int* writer_error);
/** /**
* Refresh the number of cached blocks for all data and parity disks. * Refresh the number of cached blocks for all data and parity disks.
*/ */
void (*io_refresh)(struct snapraid_io* io); extern void (*io_refresh)(struct snapraid_io* io);
#endif #endif

View file

@ -389,14 +389,14 @@ void os_clear(void);
* *
* If no log file is selected, it's 0. * If no log file is selected, it's 0.
*/ */
FILE* stdlog; extern FILE* stdlog;
/** /**
* Exit codes for testing. * Exit codes for testing.
*/ */
int exit_success; extern int exit_success;
int exit_failure; extern int exit_failure;
int exit_sync_needed; extern int exit_sync_needed;
#undef EXIT_SUCCESS #undef EXIT_SUCCESS
#undef EXIT_FAILURE #undef EXIT_FAILURE
#define EXIT_SUCCESS exit_success #define EXIT_SUCCESS exit_success

View file

@ -28,7 +28,7 @@
* *
* It's not a constant for testing purpose. * It's not a constant for testing purpose.
*/ */
unsigned STREAM_SIZE; extern unsigned STREAM_SIZE;
#define STREAM_STATE_READ 0 /**< The stream is in a normal state of read. */ #define STREAM_STATE_READ 0 /**< The stream is in a normal state of read. */
#define STREAM_STATE_WRITE 1 /**< The stream is in a normal state of write. */ #define STREAM_STATE_WRITE 1 /**< The stream is in a normal state of write. */

View file

@ -79,6 +79,7 @@ void lock_done(void)
/* print */ /* print */
int msg_level = 0; int msg_level = 0;
FILE* stdlog = 0;
/* /*
* Note that in the following functions we always flush both * Note that in the following functions we always flush both

View file

@ -415,7 +415,7 @@ int smartctl_flush(FILE* f, const char* file, const char* name);
* *
* Ensure to change that before starting any thread. * Ensure to change that before starting any thread.
*/ */
int thread_cond_signal_outside; extern int thread_cond_signal_outside;
/** /**
* Thread wrappers to handle error conditions. * Thread wrappers to handle error conditions.

View file

@ -161,7 +161,7 @@ static inline uint32_t crc32c_plain(uint32_t crc, const unsigned char* ptr, unsi
/** /**
* Compute the CRC-32 (Castagnoli) * Compute the CRC-32 (Castagnoli)
*/ */
uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size); extern uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size);
/** /**
* Internal entry points for testing. * Internal entry points for testing.

View file

@ -22,6 +22,8 @@ AC_CHECK_CC_OPT([-fno-omit-frame-pointer], CFLAGS="$CFLAGS -fno-omit-frame-point
AC_CHECK_CC_OPT([-fno-inline-functions-called-once], CFLAGS="$CFLAGS -fno-inline-functions-called-once", []) AC_CHECK_CC_OPT([-fno-inline-functions-called-once], CFLAGS="$CFLAGS -fno-inline-functions-called-once", [])
AC_CHECK_CC_OPT([-fno-inline-small-functions], CFLAGS="$CFLAGS -fno-inline-small-functions", []) AC_CHECK_CC_OPT([-fno-inline-small-functions], CFLAGS="$CFLAGS -fno-inline-small-functions", [])
AC_CHECK_CC_OPT([-rdynamic], CFLAGS="$CFLAGS -rdynamic", []) AC_CHECK_CC_OPT([-rdynamic], CFLAGS="$CFLAGS -rdynamic", [])
# This the new default for gcc 10
AC_CHECK_CC_OPT([-fno-common], CFLAGS="$CFLAGS -fno-common", [])
dnl Options to improve the performance dnl Options to improve the performance
AC_CHECK_CC_OPT([-march=native], CFLAGS="$CFLAGS -march=native", []) AC_CHECK_CC_OPT([-march=native], CFLAGS="$CFLAGS -march=native", [])