inode.c (c900529f3d9161bfde5cca0754f83b4d3c3e0220) inode.c (c26e3adc65babf681c10c109a68bc437e2eec51f)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/inode.c
4 *
5 * Copyright (C) 1992, 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 775 unchanged lines hidden (view full) ---

784/*
785 * Get block function used when preparing for buffered write if we require
786 * creating an unwritten extent if blocks haven't been allocated. The extent
787 * will be converted to written after the IO is complete.
788 */
789int ext4_get_block_unwritten(struct inode *inode, sector_t iblock,
790 struct buffer_head *bh_result, int create)
791{
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/inode.c
4 *
5 * Copyright (C) 1992, 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 775 unchanged lines hidden (view full) ---

784/*
785 * Get block function used when preparing for buffered write if we require
786 * creating an unwritten extent if blocks haven't been allocated. The extent
787 * will be converted to written after the IO is complete.
788 */
789int ext4_get_block_unwritten(struct inode *inode, sector_t iblock,
790 struct buffer_head *bh_result, int create)
791{
792 int ret = 0;
793
792 ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n",
793 inode->i_ino, create);
794 ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n",
795 inode->i_ino, create);
794 return _ext4_get_block(inode, iblock, bh_result,
796 ret = _ext4_get_block(inode, iblock, bh_result,
795 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT);
797 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT);
798
799 /*
800 * If the buffer is marked unwritten, mark it as new to make sure it is
801 * zeroed out correctly in case of partial writes. Otherwise, there is
802 * a chance of stale data getting exposed.
803 */
804 if (ret == 0 && buffer_unwritten(bh_result))
805 set_buffer_new(bh_result);
806
807 return ret;
796}
797
798/* Maximum number of blocks we map for direct IO at once. */
799#define DIO_MAX_BLOCKS 4096
800
801/*
802 * `handle' can be NULL if create is zero
803 */

--- 5383 unchanged lines hidden ---
808}
809
810/* Maximum number of blocks we map for direct IO at once. */
811#define DIO_MAX_BLOCKS 4096
812
813/*
814 * `handle' can be NULL if create is zero
815 */

--- 5383 unchanged lines hidden ---