mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Fix gcc c90 compliance warnings
Fix non-c90 compliant code, for the most part these changes simply deal with where a particular variable is declared. Under c90 it must alway be done at the very start of a block. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
+25
-13
@@ -255,7 +255,9 @@ int zfs_recover = 0;
|
||||
static void
|
||||
spa_config_lock_init(spa_t *spa)
|
||||
{
|
||||
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SCL_LOCKS; i++) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
mutex_init(&scl->scl_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
cv_init(&scl->scl_cv, NULL, CV_DEFAULT, NULL);
|
||||
@@ -268,7 +270,9 @@ spa_config_lock_init(spa_t *spa)
|
||||
static void
|
||||
spa_config_lock_destroy(spa_t *spa)
|
||||
{
|
||||
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SCL_LOCKS; i++) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
mutex_destroy(&scl->scl_lock);
|
||||
cv_destroy(&scl->scl_cv);
|
||||
@@ -281,7 +285,9 @@ spa_config_lock_destroy(spa_t *spa)
|
||||
int
|
||||
spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
|
||||
{
|
||||
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SCL_LOCKS; i++) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
if (!(locks & (1 << i)))
|
||||
continue;
|
||||
@@ -311,8 +317,9 @@ void
|
||||
spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw)
|
||||
{
|
||||
int wlocks_held = 0;
|
||||
int i;
|
||||
|
||||
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||
for (i = 0; i < SCL_LOCKS; i++) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
if (scl->scl_writer == curthread)
|
||||
wlocks_held |= (1 << i);
|
||||
@@ -341,7 +348,9 @@ spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw)
|
||||
void
|
||||
spa_config_exit(spa_t *spa, int locks, void *tag)
|
||||
{
|
||||
for (int i = SCL_LOCKS - 1; i >= 0; i--) {
|
||||
int i;
|
||||
|
||||
for (i = SCL_LOCKS - 1; i >= 0; i--) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
if (!(locks & (1 << i)))
|
||||
continue;
|
||||
@@ -360,9 +369,9 @@ spa_config_exit(spa_t *spa, int locks, void *tag)
|
||||
int
|
||||
spa_config_held(spa_t *spa, int locks, krw_t rw)
|
||||
{
|
||||
int locks_held = 0;
|
||||
int i, locks_held = 0;
|
||||
|
||||
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||
for (i = 0; i < SCL_LOCKS; i++) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
if (!(locks & (1 << i)))
|
||||
continue;
|
||||
@@ -424,6 +433,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
|
||||
{
|
||||
spa_t *spa;
|
||||
spa_config_dirent_t *dp;
|
||||
int t;
|
||||
|
||||
ASSERT(MUTEX_HELD(&spa_namespace_lock));
|
||||
|
||||
@@ -444,7 +454,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
|
||||
cv_init(&spa->spa_scrub_io_cv, NULL, CV_DEFAULT, NULL);
|
||||
cv_init(&spa->spa_suspend_cv, NULL, CV_DEFAULT, NULL);
|
||||
|
||||
for (int t = 0; t < TXG_SIZE; t++)
|
||||
for (t = 0; t < TXG_SIZE; t++)
|
||||
bplist_create(&spa->spa_free_bplist[t]);
|
||||
|
||||
(void) strlcpy(spa->spa_name, name, sizeof (spa->spa_name));
|
||||
@@ -496,6 +506,7 @@ void
|
||||
spa_remove(spa_t *spa)
|
||||
{
|
||||
spa_config_dirent_t *dp;
|
||||
int t;
|
||||
|
||||
ASSERT(MUTEX_HELD(&spa_namespace_lock));
|
||||
ASSERT(spa->spa_state == POOL_STATE_UNINITIALIZED);
|
||||
@@ -526,7 +537,7 @@ spa_remove(spa_t *spa)
|
||||
|
||||
spa_config_lock_destroy(spa);
|
||||
|
||||
for (int t = 0; t < TXG_SIZE; t++)
|
||||
for (t = 0; t < TXG_SIZE; t++)
|
||||
bplist_destroy(&spa->spa_free_bplist[t]);
|
||||
|
||||
cv_destroy(&spa->spa_async_cv);
|
||||
@@ -877,10 +888,9 @@ spa_vdev_config_enter(spa_t *spa)
|
||||
void
|
||||
spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error, char *tag)
|
||||
{
|
||||
ASSERT(MUTEX_HELD(&spa_namespace_lock));
|
||||
|
||||
int config_changed = B_FALSE;
|
||||
|
||||
ASSERT(MUTEX_HELD(&spa_namespace_lock));
|
||||
ASSERT(txg > spa_last_synced_txg(spa));
|
||||
|
||||
spa->spa_pending_vdev = NULL;
|
||||
@@ -1454,8 +1464,9 @@ uint64_t
|
||||
bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp)
|
||||
{
|
||||
uint64_t dsize = 0;
|
||||
int d;
|
||||
|
||||
for (int d = 0; d < SPA_DVAS_PER_BP; d++)
|
||||
for (d = 0; d < SPA_DVAS_PER_BP; d++)
|
||||
dsize += dva_get_dsize_sync(spa, &bp->blk_dva[d]);
|
||||
|
||||
return (dsize);
|
||||
@@ -1465,10 +1476,11 @@ uint64_t
|
||||
bp_get_dsize(spa_t *spa, const blkptr_t *bp)
|
||||
{
|
||||
uint64_t dsize = 0;
|
||||
int d;
|
||||
|
||||
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
|
||||
|
||||
for (int d = 0; d < SPA_DVAS_PER_BP; d++)
|
||||
for (d = 0; d < SPA_DVAS_PER_BP; d++)
|
||||
dsize += dva_get_dsize_sync(spa, &bp->blk_dva[d]);
|
||||
|
||||
spa_config_exit(spa, SCL_VDEV, FTAG);
|
||||
|
||||
Reference in New Issue
Block a user