Comment 0 for bug 1828763

Hyeonho Seo (seohho) wrote :

I tried to build a kernel 4.15.0-48.51 that cloned from the Ubuntu kernel git (x86_64-generic flavour).

commit c50532b9d7b623ff98aeaf0b848e58adae54ca75 (HEAD -> master, tag: Ubuntu-4.15.0-48.51, origin/master, origin/HEAD)
Author: Andrea Righi <email address hidden>
Date: Tue Apr 2 18:31:55 2019 +0200

    UBUNTU: Ubuntu-4.15.0-48.51

    Signed-off-by: Andrea Righi <email address hidden>

1. Build a kernel image with 'zfs_enable' flag set as false.
2. Build SPL/ZFS modules independently by make command (debug purpose; DECLARE_EVENT_CLASS() enabled).

But 'make' was always failed at the same point, 'zfs/module/zfs/trace.c' (as seem as below).

In file included from /home/np/linux-4.15/include/trace/define_trace.h:96:0,
                 from /home/np/linux-4.15/zfs/include/sys/trace_dmu.h:127,
                 from /home/np/linux-4.15/zfs/module/zfs/trace.c:45:
/home/np/linux-4.15/zfs/include/sys/trace_dmu.h: In function ‘trace_event_raw_event_zfs_delay_mintime_class’:
/home/np/linux-4.15/zfs/include/sys/trace_dmu.h:65:37: error: ‘dmu_tx_t {aka struct dmu_tx}’ has no member named ‘tx_dirty_delayed’
      __entry->tx_dirty_delayed = tx->tx_dirty_delayed;
                                     ^
/home/np/linux-4.15/include/trace/trace_events.h:719:4: note: in definition of macro ‘DECLARE_EVENT_CLASS’
  { assign; } \
    ^~~~~~
/home/np/linux-4.15/zfs/include/sys/trace_dmu.h:60:2: note: in expansion of macro ‘TP_fast_assign’
  TP_fast_assign(
  ^~~~~~~~~~~~~~
In file included from /home/np/linux-4.15/include/trace/define_trace.h:97:0,
                 from /home/np/linux-4.15/zfs/include/sys/trace_dmu.h:127,
                 from /home/np/linux-4.15/zfs/module/zfs/trace.c:45:
/home/np/linux-4.15/zfs/include/sys/trace_dmu.h: In function ‘perf_trace_zfs_delay_mintime_class’:
/home/np/linux-4.15/zfs/include/sys/trace_dmu.h:65:37: error: ‘dmu_tx_t {aka struct dmu_tx}’ has no member named ‘tx_dirty_delayed’
      __entry->tx_dirty_delayed = tx->tx_dirty_delayed;
                                     ^
/home/np/linux-4.15/include/trace/perf.h:66:4: note: in definition of macro ‘DECLARE_EVENT_CLASS’
  { assign; } \
    ^~~~~~
/home/np/linux-4.15/zfs/include/sys/trace_dmu.h:60:2: note: in expansion of macro ‘TP_fast_assign’
  TP_fast_assign(
  ^~~~~~~~~~~~~~

I tried to debug this issue with myself, and found something intriguing.
In 'zfs/include/sys/trace_dmu.h', the failed code accessing 'tx_dirty_delayed' from 'dmu_tx_t' (which same as 'struct dmu_tx').

DECLARE_EVENT_CLASS(zfs_delay_mintime_class,
        TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time),
        TP_ARGS(tx, dirty, min_tx_time),
        TP_STRUCT__entry(
            __field(uint64_t, tx_txg)
            __field(uint64_t, tx_lastsnap_txg)
            __field(uint64_t, tx_lasttried_txg)
            __field(boolean_t, tx_anyobj)
            __field(boolean_t, tx_dirty_delayed)
            __field(hrtime_t, tx_start)
            __field(boolean_t, tx_wait_dirty)
            __field(int, tx_err)
            __field(uint64_t, min_tx_time)
            __field(uint64_t, dirty)
        ),
        TP_fast_assign(
            __entry->tx_txg = tx->tx_txg;
            __entry->tx_lastsnap_txg = tx->tx_lastsnap_txg;
            __entry->tx_lasttried_txg = tx->tx_lasttried_txg;
            __entry->tx_anyobj = tx->tx_anyobj;
            __entry->tx_dirty_delayed = tx->tx_dirty_delayed;
            __entry->tx_start = tx->tx_start;
            __entry->tx_wait_dirty = tx->tx_wait_dirty;
            __entry->tx_err = tx->tx_err;
            __entry->dirty = dirty;
            __entry->min_tx_time = min_tx_time;
        ),
        TP_printk("tx { txg %llu lastsnap_txg %llu tx_lasttried_txg %llu "
            "anyobj %d dirty_delayed %d start %llu wait_dirty %d err %i "
            "} dirty %llu min_tx_time %llu",
            __entry->tx_txg, __entry->tx_lastsnap_txg,
            __entry->tx_lasttried_txg, __entry->tx_anyobj,
            __entry->tx_dirty_delayed, __entry->tx_start,
            __entry->tx_wait_dirty, __entry->tx_err,
            __entry->dirty, __entry->min_tx_time)
);

But, implementation of 'strcut dmu_tx' doesn't contain 'tx_dirty_delayed' (in zfs/include/sys/dmu_tx.h)

struct dmu_tx {
        /*
         * No synchronization is needed because a tx can only be handled
         * by one thread.
         */
        list_t tx_holds; /* list of dmu_tx_hold_t */
        objset_t *tx_objset;
        struct dsl_dir *tx_dir;
        struct dsl_pool *tx_pool;
        uint64_t tx_txg;
        uint64_t tx_lastsnap_txg;
        uint64_t tx_lasttried_txg;
        txg_handle_t tx_txgh;
        void *tx_tempreserve_cookie;
        struct dmu_tx_hold *tx_needassign_txh;

        /* list of dmu_tx_callback_t on this dmu_tx */
        list_t tx_callbacks;

        /* placeholder for syncing context, doesn't need specific holds */
        boolean_t tx_anyobj;

        /* has this transaction already been delayed? */
        boolean_t tx_waited;

        /* transaction is marked as being a "net free" of space */
        boolean_t tx_netfree;

        /* time this transaction was created */
        hrtime_t tx_start;

        /* need to wait for sufficient dirty space */
        boolean_t tx_wait_dirty;

        int tx_err;
};

Looks above, current in-source-tree ZFS module seems not valid... :(
Is there are walkaround for this problem?