Release 4.11 fs/hpfs/file.c
/*
* linux/fs/hpfs/file.c
*
* Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999
*
* file VFS functions
*/
#include "hpfs_fn.h"
#include <linux/mpage.h>
#define BLOCKS(size) (((size) + 511) >> 9)
static int hpfs_file_release(struct inode *inode, struct file *file)
{
hpfs_lock(inode->i_sb);
hpfs_write_if_changed(inode);
hpfs_unlock(inode->i_sb);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 25 | 65.79% | 2 | 50.00% |
Arnd Bergmann | 12 | 31.58% | 1 | 25.00% |
Al Viro | 1 | 2.63% | 1 | 25.00% |
Total | 38 | 100.00% | 4 | 100.00% |
int hpfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{
struct inode *inode = file->f_mapping->host;
int ret;
ret = filemap_write_and_wait_range(file->f_mapping, start, end);
if (ret)
return ret;
return sync_blockdev(inode->i_sb->s_bdev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Josef Bacik | 29 | 46.03% | 1 | 25.00% |
Mikulas Patocka | 19 | 30.16% | 1 | 25.00% |
Linus Torvalds (pre-git) | 15 | 23.81% | 2 | 50.00% |
Total | 63 | 100.00% | 4 | 100.00% |
/*
* generic_file_read often calls bmap with non-existing sector,
* so we must ignore such errors.
*/
static secno hpfs_bmap(struct inode *inode, unsigned file_secno, unsigned *n_secs)
{
struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
unsigned n, disk_secno;
struct fnode *fnode;
struct buffer_head *bh;
if (BLOCKS(hpfs_i(inode)->mmu_private) <= file_secno) return 0;
n = file_secno - hpfs_inode->i_file_sec;
if (n < hpfs_inode->i_n_secs) {
*n_secs = hpfs_inode->i_n_secs - n;
return hpfs_inode->i_disk_sec + n;
}
if (!(fnode = hpfs_map_fnode(inode->i_sb, inode->i_ino, &bh))) return 0;
disk_secno = hpfs_bplus_lookup(inode->i_sb, inode, &fnode->btree, file_secno, bh);
if (disk_secno == -1) return 0;
if (hpfs_chk_sectors(inode->i_sb, disk_secno, 1, "bmap")) return 0;
n = file_secno - hpfs_inode->i_file_sec;
if (n < hpfs_inode->i_n_secs) {
*n_secs = hpfs_inode->i_n_secs - n;
return hpfs_inode->i_disk_sec + n;
}
*n_secs = 1;
return disk_secno;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 130 | 62.50% | 1 | 20.00% |
Mikulas Patocka | 54 | 25.96% | 1 | 20.00% |
Linus Torvalds | 23 | 11.06% | 2 | 40.00% |
Al Viro | 1 | 0.48% | 1 | 20.00% |
Total | 208 | 100.00% | 5 | 100.00% |
void hpfs_truncate(struct inode *i)
{
if (IS_IMMUTABLE(i)) return /*-EPERM*/;
hpfs_lock_assert(i->i_sb);
hpfs_i(i)->i_n_secs = 0;
i->i_blocks = 1 + ((i->i_size + 511) >> 9);
hpfs_i(i)->mmu_private = i->i_size;
hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9));
hpfs_write_inode(i);
hpfs_i(i)->i_n_secs = 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 81 | 77.88% | 3 | 42.86% |
Al Viro | 10 | 9.62% | 1 | 14.29% |
Linus Torvalds | 7 | 6.73% | 1 | 14.29% |
Arnd Bergmann | 5 | 4.81% | 1 | 14.29% |
Mikulas Patocka | 1 | 0.96% | 1 | 14.29% |
Total | 104 | 100.00% | 7 | 100.00% |
static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
{
int r;
secno s;
unsigned n_secs;
hpfs_lock(inode->i_sb);
s = hpfs_bmap(inode, iblock, &n_secs);
if (s) {
if (bh_result->b_size >> 9 < n_secs)
n_secs = bh_result->b_size >> 9;
n_secs = hpfs_search_hotfix_map_for_range(inode->i_sb, s, n_secs);
if (unlikely(!n_secs)) {
s = hpfs_search_hotfix_map(inode->i_sb, s);
n_secs = 1;
}
map_bh(bh_result, inode->i_sb, s);
bh_result->b_size = n_secs << 9;
goto ret_0;
}
if (!create) goto ret_0;
if (iblock<<9 != hpfs_i(inode)->mmu_private) {
BUG();
r = -EIO;
goto ret_r;
}
if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) {
hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1);
r = -ENOSPC;
goto ret_r;
}
inode->i_blocks++;
hpfs_i(inode)->mmu_private += 512;
set_buffer_new(bh_result);
map_bh(bh_result, inode->i_sb, hpfs_search_hotfix_map(inode->i_sb, s));
ret_0:
r = 0;
ret_r:
hpfs_unlock(inode->i_sb);
return r;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 131 | 46.79% | 4 | 33.33% |
Mikulas Patocka | 121 | 43.21% | 3 | 25.00% |
Linus Torvalds | 24 | 8.57% | 3 | 25.00% |
Andrew Morton | 3 | 1.07% | 1 | 8.33% |
Al Viro | 1 | 0.36% | 1 | 8.33% |
Total | 280 | 100.00% | 12 | 100.00% |
static int hpfs_readpage(struct file *file, struct page *page)
{
return mpage_readpage(page, hpfs_get_block);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikulas Patocka | 24 | 100.00% | 1 | 100.00% |
Total | 24 | 100.00% | 1 | 100.00% |
static int hpfs_writepage(struct page *page, struct writeback_control *wbc)
{
return block_write_full_page(page, hpfs_get_block, wbc);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 19 | 73.08% | 4 | 80.00% |
Andrew Morton | 7 | 26.92% | 1 | 20.00% |
Total | 26 | 100.00% | 5 | 100.00% |
static int hpfs_readpages(struct file *file, struct address_space *mapping,
struct list_head *pages, unsigned nr_pages)
{
return mpage_readpages(mapping, pages, nr_pages, hpfs_get_block);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikulas Patocka | 22 | 61.11% | 1 | 25.00% |
Linus Torvalds (pre-git) | 14 | 38.89% | 3 | 75.00% |
Total | 36 | 100.00% | 4 | 100.00% |
static int hpfs_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
return mpage_writepages(mapping, wbc, hpfs_get_block);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikulas Patocka | 21 | 80.77% | 1 | 33.33% |
Linus Torvalds (pre-git) | 5 | 19.23% | 2 | 66.67% |
Total | 26 | 100.00% | 3 | 100.00% |
static void hpfs_write_failed(struct address_space *mapping, loff_t to)
{
struct inode *inode = mapping->host;
hpfs_lock(inode->i_sb);
if (to > inode->i_size) {
truncate_pagecache(inode, inode->i_size);
hpfs_truncate(inode);
}
hpfs_unlock(inode->i_sb);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Marco Stornelli | 47 | 77.05% | 1 | 50.00% |
Mikulas Patocka | 14 | 22.95% | 1 | 50.00% |
Total | 61 | 100.00% | 2 | 100.00% |
static int hpfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{
int ret;
*pagep = NULL;
ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
hpfs_get_block,
&hpfs_i(mapping->host)->mmu_private);
if (unlikely(ret))
hpfs_write_failed(mapping, pos + len);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Nicholas Piggin | 36 | 38.30% | 1 | 12.50% |
Linus Torvalds (pre-git) | 31 | 32.98% | 4 | 50.00% |
Christoph Hellwig | 21 | 22.34% | 1 | 12.50% |
Marco Stornelli | 3 | 3.19% | 1 | 12.50% |
Linus Torvalds | 3 | 3.19% | 1 | 12.50% |
Total | 94 | 100.00% | 8 | 100.00% |
static int hpfs_write_end(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied,
struct page *pagep, void *fsdata)
{
struct inode *inode = mapping->host;
int err;
err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
if (err < len)
hpfs_write_failed(mapping, pos + len);
if (!(err < 0)) {
/* make sure we write it on close, if not earlier */
hpfs_lock(inode->i_sb);
hpfs_i(inode)->i_dirty = 1;
hpfs_unlock(inode->i_sb);
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 118 | 100.00% | 1 | 100.00% |
Total | 118 | 100.00% | 1 | 100.00% |
static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping, block, hpfs_get_block);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 22 | 91.67% | 4 | 80.00% |
Andrew Morton | 2 | 8.33% | 1 | 20.00% |
Total | 24 | 100.00% | 5 | 100.00% |
static int hpfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len)
{
return generic_block_fiemap(inode, fieinfo, start, len, hpfs_get_block);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikulas Patocka | 36 | 100.00% | 1 | 100.00% |
Total | 36 | 100.00% | 1 | 100.00% |
const struct address_space_operations hpfs_aops = {
.readpage = hpfs_readpage,
.writepage = hpfs_writepage,
.readpages = hpfs_readpages,
.writepages = hpfs_writepages,
.write_begin = hpfs_write_begin,
.write_end = hpfs_write_end,
.bmap = _hpfs_bmap
};
const struct file_operations hpfs_file_ops =
{
.llseek = generic_file_llseek,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.mmap = generic_file_mmap,
.release = hpfs_file_release,
.fsync = hpfs_file_fsync,
.splice_read = generic_file_splice_read,
.unlocked_ioctl = hpfs_ioctl,
};
const struct inode_operations hpfs_file_iops =
{
.setattr = hpfs_setattr,
.fiemap = hpfs_fiemap,
};
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 495 | 39.32% | 8 | 20.51% |
Mikulas Patocka | 335 | 26.61% | 7 | 17.95% |
Al Viro | 177 | 14.06% | 5 | 12.82% |
Linus Torvalds | 64 | 5.08% | 4 | 10.26% |
Marco Stornelli | 50 | 3.97% | 1 | 2.56% |
Nicholas Piggin | 39 | 3.10% | 1 | 2.56% |
Josef Bacik | 29 | 2.30% | 1 | 2.56% |
Christoph Hellwig | 23 | 1.83% | 3 | 7.69% |
Arnd Bergmann | 17 | 1.35% | 1 | 2.56% |
Andrew Morton | 12 | 0.95% | 3 | 7.69% |
Art Haas | 10 | 0.79% | 1 | 2.56% |
Badari Pulavarty | 4 | 0.32% | 1 | 2.56% |
Jens Axboe | 2 | 0.16% | 1 | 2.56% |
Arjan van de Ven | 2 | 0.16% | 2 | 5.13% |
Total | 1259 | 100.00% | 39 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.