631 goto out_unlock_internal;
632 }
633 xfs_ilock(xip, XFS_ILOCK_EXCL);
634 eventsent = 1;
635
636
637
638
639
640
641
642
643 if ((file->f_flags & O_APPEND) && pos != xip->i_size)
644 goto start;
645 }
646
647 if (ioflags & IO_ISDIRECT) {
648 xfs_buftarg_t *target =
649 XFS_IS_REALTIME_INODE(xip) ?
650 mp->m_rtdev_targp : mp->m_ddev_targp;
651
652 if ((pos & target->bt_smask) || (count & target->bt_smask)) {
653 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
654 return XFS_ERROR(-EINVAL);
655 }
656
657 if (!need_i_mutex && (mapping->nrpages || pos > xip->i_size)) {
658 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
659 iolock = XFS_IOLOCK_EXCL;
660 need_i_mutex = 1;
661 mutex_lock(&inode->i_mutex);
662 xfs_ilock(xip, XFS_ILOCK_EXCL|iolock);
663 goto start;
664 }
665 }
666
667 new_size = pos + count;
668 if (new_size > xip->i_size)
669 xip->i_new_size = new_size;
670
671