From: Dave Chinner Date: Tue, 3 Nov 2015 02:28:41 +0000 (+1100) Subject: Merge branch 'xfs-dax-updates' into for-next X-Git-Tag: v4.4-rc1~30^2~1 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=264e89ad3412ce1e2977e5e807bcf7d20d3b0a59 Merge branch 'xfs-dax-updates' into for-next --- 264e89ad3412ce1e2977e5e807bcf7d20d3b0a59 diff --cc fs/xfs/xfs_aops.c index e4fff5898c1c,69c2dbc20836..29e7e5dd5178 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@@ -1405,15 -1421,16 +1430,16 @@@ __xfs_get_blocks if (create && (!nimaps || (imap.br_startblock == HOLESTARTBLOCK || - imap.br_startblock == DELAYSTARTBLOCK))) { + imap.br_startblock == DELAYSTARTBLOCK) || + (IS_DAX(inode) && ISUNWRITTEN(&imap)))) { if (direct || xfs_get_extsz_hint(ip)) { /* - * Drop the ilock in preparation for starting the block - * allocation transaction. It will be retaken - * exclusively inside xfs_iomap_write_direct for the - * actual allocation. + * xfs_iomap_write_direct() expects the shared lock. It + * is unlocked on return. */ - xfs_iunlock(ip, lockmode); + if (lockmode == XFS_ILOCK_EXCL) + xfs_ilock_demote(ip, lockmode); + error = xfs_iomap_write_direct(ip, offset, size, &imap, nimaps); if (error) diff --cc fs/xfs/xfs_iomap.c index c3cb5a552c4e,b48c6b525e77..f4f5b43cf647 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@@ -131,13 -131,14 +131,14 @@@ xfs_iomap_write_direct uint qblocks, resblks, resrtextents; int committed; int error; + int lockmode; + int bmapi_flags = XFS_BMAPI_PREALLOC; - error = xfs_qm_dqattach(ip, 0); - if (error) - return error; - rt = XFS_IS_REALTIME_INODE(ip); extsz = xfs_get_extsz_hint(ip); + lockmode = XFS_ILOCK_SHARED; /* locked by caller */ + + ASSERT(xfs_isilocked(ip, lockmode)); offset_fsb = XFS_B_TO_FSBT(mp, offset); last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); @@@ -221,7 -220,7 +239,7 @@@ xfs_bmap_init(&free_list, &firstfsb); nimaps = 1; error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, - XFS_BMAPI_PREALLOC, &firstfsb, resblks, imap, - bmapi_flags, &firstfsb, 0, imap, ++ bmapi_flags, &firstfsb, resblks, imap, &nimaps, &free_list); if (error) goto out_bmap_cancel;