openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/systemd/1_242+AUTOINC+db2e367bfc-r0/git/src/journal/journal-file.c
static void journal_file_set_offline_internal(JournalFile* f)
{
    assert(f);
    assert(f->fd >= 0);
    assert(f->header);

    for (;;)
    {
        switch (f->offline_state)
        {
            case OFFLINE_CANCEL:
                if (!__sync_bool_compare_and_swap(&f->offline_state,
                                                  OFFLINE_CANCEL, OFFLINE_DONE))
                    continue;
                return;

            case OFFLINE_AGAIN_FROM_SYNCING:
                if (!__sync_bool_compare_and_swap(&f->offline_state,
                                                  OFFLINE_AGAIN_FROM_SYNCING,
                                                  OFFLINE_SYNCING))
                    continue;
                break;

            case OFFLINE_AGAIN_FROM_OFFLINING:
                if (!__sync_bool_compare_and_swap(&f->offline_state,
                                                  OFFLINE_AGAIN_FROM_OFFLINING,
                                                  OFFLINE_SYNCING))
                    continue;
                break;

            case OFFLINE_SYNCING:
                (void)fsync(f->fd);

                if (!__sync_bool_compare_and_swap(
                        &f->offline_state, OFFLINE_SYNCING, OFFLINE_OFFLINING))
                    continue;

                f->header->state = f->archive ? STATE_ARCHIVED : STATE_OFFLINE;
                (void)fsync(f->fd);
                break;

            case OFFLINE_OFFLINING:
                if (!__sync_bool_compare_and_swap(
                        &f->offline_state, OFFLINE_OFFLINING, OFFLINE_DONE))
                    continue;
                _fallthrough_;
            case OFFLINE_DONE:
                return;

            case OFFLINE_JOINED:
                log_debug("OFFLINE_JOINED unexpected offline state for "
                          "journal_file_set_offline_internal()");
                return;
        }
    }
}
/* This may be called from a separate thread to prevent blocking the caller for
 * the duration of fsync(). As a result we use atomic operations on
 * f->offline_state for inter-thread communications with
 * journal_file_set_offline() and journal_file_set_online(). */
This may be called from a separate thread to prevent blocking the caller for
the duration of fsync(). As a result we use atomic operations on
f->offline_state for inter-thread communications with
journal_file_set_offline() and journal_file_set_online().
This may be called from a separate thread to prevent blocking the caller for the duration of fsync () . As a result we use atomic operations on f - > offline_state for inter - thread communications with journal_file_set_offline () and journal_file_set_online () .
static void journal_file_set_offline_internal(JournalFile* f)
{
    assert(f);
    assert(f->fd >= 0);
    assert(f->header);
    for (;;)
    {
        switch (f->offline_state)
        {
            case OFFLINE_CANCEL:
                if (!__sync_bool_compare_and_swap(&f->offline_state,
                                                  OFFLINE_CANCEL, OFFLINE_DONE))
                    continue;
                return;
            case OFFLINE_AGAIN_FROM_SYNCING:
                if (!__sync_bool_compare_and_swap(&f->offline_state,
                                                  OFFLINE_AGAIN_FROM_SYNCING,
                                                  OFFLINE_SYNCING))
                    continue;
                break;
            case OFFLINE_AGAIN_FROM_OFFLINING:
                if (!__sync_bool_compare_and_swap(&f->offline_state,
                                                  OFFLINE_AGAIN_FROM_OFFLINING,
                                                  OFFLINE_SYNCING))
                    continue;
                break;
            case OFFLINE_SYNCING:
                (void)fsync(f->fd);
                if (!__sync_bool_compare_and_swap(
                        &f->offline_state, OFFLINE_SYNCING, OFFLINE_OFFLINING))
                    continue;
                f->header->state = f->archive ? STATE_ARCHIVED : STATE_OFFLINE;
                (void)fsync(f->fd);
                break;
            case OFFLINE_OFFLINING:
                if (!__sync_bool_compare_and_swap(
                        &f->offline_state, OFFLINE_OFFLINING, OFFLINE_DONE))
                    continue;
                _fallthrough_;
            case OFFLINE_DONE:
                return;
            case OFFLINE_JOINED:
                log_debug("OFFLINE_JOINED unexpected offline state for "
                          "journal_file_set_offline_internal()");
                return;
        }
    }
}
static void journal_file_set_offline_internal ( JournalFile * f ) { assert ( f ) ; assert ( f -> fd >= 0 ) ; assert ( f -> header ) ; for ( ; ; ) { switch ( f -> offline_state ) { case OFFLINE_CANCEL : if ( ! __sync_bool_compare_and_swap ( & f -> offline_state , OFFLINE_CANCEL , OFFLINE_DONE ) ) continue ; return ; case OFFLINE_AGAIN_FROM_SYNCING : if ( ! __sync_bool_compare_and_swap ( & f -> offline_state , OFFLINE_AGAIN_FROM_SYNCING , OFFLINE_SYNCING ) ) continue ; break ; case OFFLINE_AGAIN_FROM_OFFLINING : if ( ! __sync_bool_compare_and_swap ( & f -> offline_state , OFFLINE_AGAIN_FROM_OFFLINING , OFFLINE_SYNCING ) ) continue ; break ; case OFFLINE_SYNCING : ( void ) fsync ( f -> fd ) ; if ( ! __sync_bool_compare_and_swap ( & f -> offline_state , OFFLINE_SYNCING , OFFLINE_OFFLINING ) ) continue ; f -> header -> state = f -> archive ? STATE_ARCHIVED : STATE_OFFLINE ; ( void ) fsync ( f -> fd ) ; break ; case OFFLINE_OFFLINING : if ( ! __sync_bool_compare_and_swap ( & f -> offline_state , OFFLINE_OFFLINING , OFFLINE_DONE ) ) continue ; _fallthrough_ ; case OFFLINE_DONE : return ; case OFFLINE_JOINED : log_debug ( " " " " ) ; return ; } } }
This may be called from a separate thread to prevent blocking the caller for
 the duration of fsync().
This may be called from a separate thread to prevent blocking the caller for the duration of fsync () .