inode.c (592ddec7578a33fb6b3e2ba78aed91614bbb30e2) inode.c (643fa9612bf1a29153eee46fd398117632f93cbe)
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)

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

1145 clear_buffer_dirty(bh);
1146 BUFFER_TRACE(bh, "get write access");
1147 ret = ext4_journal_get_write_access(handle, bh);
1148 if (!ret && dirty)
1149 ret = ext4_handle_dirty_metadata(handle, NULL, bh);
1150 return ret;
1151}
1152
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)

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

1145 clear_buffer_dirty(bh);
1146 BUFFER_TRACE(bh, "get write access");
1147 ret = ext4_journal_get_write_access(handle, bh);
1148 if (!ret && dirty)
1149 ret = ext4_handle_dirty_metadata(handle, NULL, bh);
1150 return ret;
1151}
1152
1153#ifdef CONFIG_EXT4_FS_ENCRYPTION
1153#ifdef CONFIG_FS_ENCRYPTION
1154static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
1155 get_block_t *get_block)
1156{
1157 unsigned from = pos & (PAGE_SIZE - 1);
1158 unsigned to = from + len;
1159 struct inode *inode = page->mapping->host;
1160 unsigned block_start, block_end;
1161 sector_t block;

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

1297 unlock_page(page);
1298 put_page(page);
1299 ext4_journal_stop(handle);
1300 goto retry_grab;
1301 }
1302 /* In case writeback began while the page was unlocked */
1303 wait_for_stable_page(page);
1304
1154static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
1155 get_block_t *get_block)
1156{
1157 unsigned from = pos & (PAGE_SIZE - 1);
1158 unsigned to = from + len;
1159 struct inode *inode = page->mapping->host;
1160 unsigned block_start, block_end;
1161 sector_t block;

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

1297 unlock_page(page);
1298 put_page(page);
1299 ext4_journal_stop(handle);
1300 goto retry_grab;
1301 }
1302 /* In case writeback began while the page was unlocked */
1303 wait_for_stable_page(page);
1304
1305#ifdef CONFIG_EXT4_FS_ENCRYPTION
1305#ifdef CONFIG_FS_ENCRYPTION
1306 if (ext4_should_dioread_nolock(inode))
1307 ret = ext4_block_write_begin(page, pos, len,
1308 ext4_get_block_unwritten);
1309 else
1310 ret = ext4_block_write_begin(page, pos, len,
1311 ext4_get_block);
1312#else
1313 if (ext4_should_dioread_nolock(inode))

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

3099 unlock_page(page);
3100 put_page(page);
3101 ext4_journal_stop(handle);
3102 goto retry_grab;
3103 }
3104 /* In case writeback began while the page was unlocked */
3105 wait_for_stable_page(page);
3106
1306 if (ext4_should_dioread_nolock(inode))
1307 ret = ext4_block_write_begin(page, pos, len,
1308 ext4_get_block_unwritten);
1309 else
1310 ret = ext4_block_write_begin(page, pos, len,
1311 ext4_get_block);
1312#else
1313 if (ext4_should_dioread_nolock(inode))

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

3099 unlock_page(page);
3100 put_page(page);
3101 ext4_journal_stop(handle);
3102 goto retry_grab;
3103 }
3104 /* In case writeback began while the page was unlocked */
3105 wait_for_stable_page(page);
3106
3107#ifdef CONFIG_EXT4_FS_ENCRYPTION
3107#ifdef CONFIG_FS_ENCRYPTION
3108 ret = ext4_block_write_begin(page, pos, len,
3109 ext4_da_get_block_prep);
3110#else
3111 ret = __block_write_begin(page, pos, len, ext4_da_get_block_prep);
3112#endif
3113 if (ret < 0) {
3114 unlock_page(page);
3115 ext4_journal_stop(handle);

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

3874static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
3875{
3876 struct file *file = iocb->ki_filp;
3877 struct inode *inode = file->f_mapping->host;
3878 size_t count = iov_iter_count(iter);
3879 loff_t offset = iocb->ki_pos;
3880 ssize_t ret;
3881
3108 ret = ext4_block_write_begin(page, pos, len,
3109 ext4_da_get_block_prep);
3110#else
3111 ret = __block_write_begin(page, pos, len, ext4_da_get_block_prep);
3112#endif
3113 if (ret < 0) {
3114 unlock_page(page);
3115 ext4_journal_stop(handle);

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

3874static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
3875{
3876 struct file *file = iocb->ki_filp;
3877 struct inode *inode = file->f_mapping->host;
3878 size_t count = iov_iter_count(iter);
3879 loff_t offset = iocb->ki_pos;
3880 ssize_t ret;
3881
3882#ifdef CONFIG_EXT4_FS_ENCRYPTION
3882#ifdef CONFIG_FS_ENCRYPTION
3883 if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode))
3884 return 0;
3885#endif
3886
3887 /*
3888 * If we are doing data journalling we don't support O_DIRECT
3889 */
3890 if (ext4_should_journal_data(inode))

--- 2430 unchanged lines hidden ---
3883 if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode))
3884 return 0;
3885#endif
3886
3887 /*
3888 * If we are doing data journalling we don't support O_DIRECT
3889 */
3890 if (ext4_should_journal_data(inode))

--- 2430 unchanged lines hidden ---