filemap.c (cf9a2ae8d49948f861b56e5333530e491a9da190) filemap.c (9361401eb7619c033e2394e4f9f6d410d6719ac7)
1/*
2 * linux/mm/filemap.c
3 *
4 * Copyright (C) 1994-1999 Linus Torvalds
5 */
6
7/*
8 * This file handles the generic file mmap semantics used by

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

2015 return -EFBIG;
2016 }
2017 /* zero-length writes at ->s_maxbytes are OK */
2018 }
2019
2020 if (unlikely(*pos + *count > inode->i_sb->s_maxbytes))
2021 *count = inode->i_sb->s_maxbytes - *pos;
2022 } else {
1/*
2 * linux/mm/filemap.c
3 *
4 * Copyright (C) 1994-1999 Linus Torvalds
5 */
6
7/*
8 * This file handles the generic file mmap semantics used by

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

2015 return -EFBIG;
2016 }
2017 /* zero-length writes at ->s_maxbytes are OK */
2018 }
2019
2020 if (unlikely(*pos + *count > inode->i_sb->s_maxbytes))
2021 *count = inode->i_sb->s_maxbytes - *pos;
2022 } else {
2023#ifdef CONFIG_BLOCK
2023 loff_t isize;
2024 if (bdev_read_only(I_BDEV(inode)))
2025 return -EPERM;
2026 isize = i_size_read(inode);
2027 if (*pos >= isize) {
2028 if (*count || *pos > isize)
2029 return -ENOSPC;
2030 }
2031
2032 if (*pos + *count > isize)
2033 *count = isize - *pos;
2024 loff_t isize;
2025 if (bdev_read_only(I_BDEV(inode)))
2026 return -EPERM;
2027 isize = i_size_read(inode);
2028 if (*pos >= isize) {
2029 if (*count || *pos > isize)
2030 return -ENOSPC;
2031 }
2032
2033 if (*pos + *count > isize)
2034 *count = isize - *pos;
2035#else
2036 return -EPERM;
2037#endif
2034 }
2035 return 0;
2036}
2037EXPORT_SYMBOL(generic_write_checks);
2038
2039ssize_t
2040generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
2041 unsigned long *nr_segs, loff_t pos, loff_t *ppos,

--- 482 unchanged lines hidden ---
2038 }
2039 return 0;
2040}
2041EXPORT_SYMBOL(generic_write_checks);
2042
2043ssize_t
2044generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
2045 unsigned long *nr_segs, loff_t pos, loff_t *ppos,

--- 482 unchanged lines hidden ---