Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails on Snow Leopard / MacPorts 2.1.3 / gcc 4.2.1 #6

Closed
BjoKaSH opened this issue Apr 10, 2013 · 3 comments
Closed

Compilation fails on Snow Leopard / MacPorts 2.1.3 / gcc 4.2.1 #6

BjoKaSH opened this issue Apr 10, 2013 · 3 comments

Comments

@BjoKaSH
Copy link
Contributor

BjoKaSH commented Apr 10, 2013

Compilation fails in dsl_scan.c and zio.c when trying to inline some function marked as "always inline":

zio.c: In function ‘zio_ready’:
zio.c:1250: error: ‘always_inline’ function could not be inlined in call to ‘__zio_execute’: function not considered for inlining
zio.c:537: error: called from here

dsl_scan.c: In function ‘dsl_scan_visitbp’:
dsl_scan.c:712: error: ‘always_inline’ function could not be inlined in call to ‘dsl_scan_visitdnode’: function not considered for inlining
dsl_scan.c:668: error: called from here
dsl_scan.c:712: error: ‘always_inline’ function could not be inlined in call to ‘dsl_scan_visitdnode’: function not considered for inlining
dsl_scan.c:686: error: called from here
dsl_scan.c:712: error: ‘always_inline’ function could not be inlined in call to ‘dsl_scan_visitdnode’: function not considered for inlining
dsl_scan.c:696: error: called from here
dsl_scan.c:712: error: ‘always_inline’ function could not be inlined in call to ‘dsl_scan_visitdnode’: function not considered for inlining
dsl_scan.c:699: error: called from here

A work-around is to remove the always inle qualifier, but the question is, if that is wise to do.

diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c
index 297caa0..fa344ea 100644
--- a/module/zfs/dsl_scan.c
+++ b/module/zfs/dsl_scan.c
@@ -599,7 +599,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp,
  * Return nonzero on i/o error.
  * Return new buf to write out in *bufp.
  */
-inline __attribute__((always_inline)) static int
+inline /* __attribute__((always_inline)) */ static int
 dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
     dnode_phys_t *dnp, const blkptr_t *bp,
     const zbookmark_t *zb, dmu_tx_t *tx, arc_buf_t **bufp)
@@ -705,7 +705,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
        return (0);
 }
 
-inline __attribute__((always_inline)) static void
+inline /* __attribute__((always_inline)) */ static void
 dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
     dmu_objset_type_t ostype, dnode_phys_t *dnp, arc_buf_t *buf,
     uint64_t object, dmu_tx_t *tx)
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index bc7b759..594406e 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -1244,7 +1244,7 @@ zio_execute(zio_t *zio)
        __zio_execute(zio);
 }
 
-__attribute__((always_inline))
+/* __attribute__((always_inline)) */
 static inline void
 __zio_execute(zio_t *zio)
 {
@lundman
Copy link
Contributor

lundman commented Apr 10, 2013

That is correct, you can just comment out the "always inline" to compile (But I have not tried more than that).

The Linux version does this to an attempt to save on stack-usage, on the functions that are called recursively. Linux has more restrictive stackusage than Solaris. I do not know where OSX lies in this, or if we will have issues with it in future

@lundman
Copy link
Contributor

lundman commented Apr 10, 2013

We could remove it for all versions until we know if it will break, or use some autoconf checks like
https://github.com/penberg/classpath/blob/master/m4/gcc_attribute.m4
to correctly handle the case where it isn't supported.

@BjoKaSH
Copy link
Contributor Author

BjoKaSH commented Apr 15, 2013

Temporarily fixed by commit 9fc59df. But we still need a proper automake/autoconf check for this.

@BjoKaSH BjoKaSH closed this as completed Apr 15, 2013
lundman added a commit that referenced this issue Sep 2, 2015
Which the stack like:
    frame #2: 0xffffff800292e4a5 kernel`cache_purge
    frame #3: 0xffffff7f83281ee8 zfs`zfs_vnop_reclaim + 152
    frame #4: 0xffffff80029468f0 kernel`vclean
    frame #6: 0xffffff80029463cb kernel`vnode_reclaim_internal
    frame #9: 0xffffff800293f4b6 kernel`vnode_create
    frame #10: 0xffffff7f83283c41 zfs`zfs_znode_getvnode + 513
    frame #11: 0xffffff7f83288d78 zfs`zfs_zget_internal + 984
    frame #12: 0xffffff7f832764c9 zfs`zfs_vfs_vget + 329
    frame #13: 0xffffff800293979d kernel`namei

It would seem vnop_reclaim can not call into VFS again as it already
holds locks, and verifying with hfs_vnop_reclaim, they do not
call cache_purge().
lundman added a commit that referenced this issue Sep 3, 2015
Which the stack like:
    frame #2: 0xffffff800292e4a5 kernel`cache_purge
    frame #3: 0xffffff7f83281ee8 zfs`zfs_vnop_reclaim + 152
    frame #4: 0xffffff80029468f0 kernel`vclean
    frame #6: 0xffffff80029463cb kernel`vnode_reclaim_internal
    frame #9: 0xffffff800293f4b6 kernel`vnode_create
    frame #10: 0xffffff7f83283c41 zfs`zfs_znode_getvnode + 513
    frame #11: 0xffffff7f83288d78 zfs`zfs_zget_internal + 984
    frame #12: 0xffffff7f832764c9 zfs`zfs_vfs_vget + 329
    frame #13: 0xffffff800293979d kernel`namei

It would seem vnop_reclaim can not call into VFS again as it already
holds locks, and verifying with hfs_vnop_reclaim, they do not
call cache_purge().
lundman added a commit that referenced this issue Oct 21, 2015
Which the stack like:
    frame #2: 0xffffff800292e4a5 kernel`cache_purge
    frame #3: 0xffffff7f83281ee8 zfs`zfs_vnop_reclaim + 152
    frame #4: 0xffffff80029468f0 kernel`vclean
    frame #6: 0xffffff80029463cb kernel`vnode_reclaim_internal
    frame #9: 0xffffff800293f4b6 kernel`vnode_create
    frame #10: 0xffffff7f83283c41 zfs`zfs_znode_getvnode + 513
    frame #11: 0xffffff7f83288d78 zfs`zfs_zget_internal + 984
    frame #12: 0xffffff7f832764c9 zfs`zfs_vfs_vget + 329
    frame #13: 0xffffff800293979d kernel`namei

It would seem vnop_reclaim can not call into VFS again as it already
holds locks, and verifying with hfs_vnop_reclaim, they do not
call cache_purge().
lundman added a commit that referenced this issue Jan 23, 2017
Which the stack like:
    frame #2: 0xffffff800292e4a5 kernel`cache_purge
    frame #3: 0xffffff7f83281ee8 zfs`zfs_vnop_reclaim + 152
    frame #4: 0xffffff80029468f0 kernel`vclean
    frame #6: 0xffffff80029463cb kernel`vnode_reclaim_internal
    frame #9: 0xffffff800293f4b6 kernel`vnode_create
    frame #10: 0xffffff7f83283c41 zfs`zfs_znode_getvnode + 513
    frame #11: 0xffffff7f83288d78 zfs`zfs_zget_internal + 984
    frame #12: 0xffffff7f832764c9 zfs`zfs_vfs_vget + 329
    frame #13: 0xffffff800293979d kernel`namei

It would seem vnop_reclaim can not call into VFS again as it already
holds locks, and verifying with hfs_vnop_reclaim, they do not
call cache_purge().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants