If there is not enough free segment, we should not assign a new segment
explicitly. Otherwise, we can run out of free segment.
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
        mutex_lock(&sit_i->sentry_lock);
 
        /* direct_io'ed data is aligned to the segment for better performance */
-       if (direct_io && curseg->next_blkoff)
+       if (direct_io && curseg->next_blkoff &&
+                               !has_not_enough_free_secs(sbi, 0))
                __allocate_new_segments(sbi, type);
 
        *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);