[Fwd: [PATCH 1/8] reiser4-add-crc-sendfile.patch]

From: Hans Reiser
Date: Wed Nov 16 2005 - 02:57:44 EST



--- Begin Message --- .

From: Edward Shishkin <edward@xxxxxxxxxxx>

This patch adds sendfile method for cryptcompress files.

Signed-off-by: Vladimir V. Saveliev <vs@xxxxxxxxxxx>


fs/reiser4/plugin/file/cryptcompress.c | 35 +++++++++++++++++++++++++++++++--
fs/reiser4/plugin/file/file.h | 2 +
fs/reiser4/plugin/object.c | 3 +-
3 files changed, 37 insertions(+), 3 deletions(-)

diff -puN fs/reiser4/plugin/file/cryptcompress.c~reiser4-add-crc-sendfile fs/reiser4/plugin/file/cryptcompress.c
--- linux-2.6.14-mm2/fs/reiser4/plugin/file/cryptcompress.c~reiser4-add-crc-sendfile 2005-11-15 16:58:35.000000000 +0300
+++ linux-2.6.14-mm2-vs/fs/reiser4/plugin/file/cryptcompress.c 2005-11-15 17:08:26.000000000 +0300
@@ -3670,8 +3670,8 @@ int capturepage_cryptcompress(struct pag
/* plugin->u.file.mmap */
int mmap_cryptcompress(struct file *file, struct vm_area_struct *vma)
{
- return -ENOSYS;
- //return generic_file_mmap(file, vma);
+ //return -ENOSYS;
+ return generic_file_mmap(file, vma);
}

/* plugin->u.file.release */
@@ -3834,6 +3834,37 @@ int setattr_cryptcompress(struct dentry
return result;
}

+/* sendfile_cryptcompress - sendfile of struct file_operations */
+ssize_t
+sendfile_cryptcompress(struct file *file, loff_t *ppos, size_t count,
+ read_actor_t actor, void *target)
+{
+ reiser4_context *ctx;
+ ssize_t result;
+ struct inode *inode;
+ cryptcompress_info_t *info;
+
+ inode = file->f_dentry->d_inode;
+ ctx = init_context(inode->i_sb);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
+ /*
+ * generic_file_sndfile may want to call update_atime. Grab space for
+ * stat data update
+ */
+ result = reiser4_grab_space(estimate_update_common(inode),
+ BA_CAN_COMMIT);
+ if (result)
+ goto exit;
+ info = cryptcompress_inode_data(inode);
+ down_read(&info->lock);
+ result = generic_file_sendfile(file, ppos, count, actor, target);
+ up_read(&info->lock);
+ exit:
+ reiser4_exit_context(ctx);
+ return result;
+}
+
static int
save_len_cryptcompress_plugin(struct inode *inode, reiser4_plugin * plugin)
{
diff -puN fs/reiser4/plugin/file/file.h~reiser4-add-crc-sendfile fs/reiser4/plugin/file/file.h
--- linux-2.6.14-mm2/fs/reiser4/plugin/file/file.h~reiser4-add-crc-sendfile 2005-11-15 16:58:35.000000000 +0300
+++ linux-2.6.14-mm2-vs/fs/reiser4/plugin/file/file.h 2005-11-15 16:58:35.000000000 +0300
@@ -169,6 +169,8 @@ ssize_t read_cryptcompress(struct file *
ssize_t write_cryptcompress(struct file *, const char __user *buf, size_t write_amount,
loff_t * off);
int mmap_cryptcompress(struct file *, struct vm_area_struct *);
+ssize_t sendfile_cryptcompress(struct file *file, loff_t *ppos, size_t count,
+ read_actor_t actor, void *target);

/* address space operations */
extern int readpage_cryptcompress(struct file *, struct page *);
diff -puN fs/reiser4/plugin/object.c~reiser4-add-crc-sendfile fs/reiser4/plugin/object.c
--- linux-2.6.14-mm2/fs/reiser4/plugin/object.c~reiser4-add-crc-sendfile 2005-11-15 16:58:35.000000000 +0300
+++ linux-2.6.14-mm2-vs/fs/reiser4/plugin/object.c 2005-11-15 16:58:35.000000000 +0300
@@ -306,7 +306,7 @@ file_plugin file_plugins[LAST_FILE_PLUGI
.write = write_cryptcompress,
.mmap = mmap_cryptcompress,
.fsync = sync_common,
- .sendfile = sendfile_common
+ .sendfile = sendfile_cryptcompress
},
.as_ops = {
.writepage = reiser4_writepage,
@@ -331,6 +331,7 @@ file_plugin file_plugins[LAST_FILE_PLUGI
.owns_item = owns_item_common,
.can_add_link = can_add_link_common,
.detach = dummyop,
+ .bind = dummyop,
.safelink = safelink_common,
.estimate = {
.create = estimate_create_common,

_

--- End Message ---