Commit 52e2d0a3 authored by Martin Brandenburg's avatar Martin Brandenburg Committed by Mike Marshall

orangefs: write range tracking

Attach the actual range of bytes written to plus the responsible uid/gid
to each dirty page.  This information must be sent to the server when
the page is written out.

Now write_begin, page_mkwrite, and invalidatepage keep up with this
information.  There are several conditions where they must write out the
page immediately to store the new range.  Two non-contiguous ranges
cannot be stored on a single page.
Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent 90fc0706
...@@ -46,8 +46,8 @@ static int flush_racache(struct inode *inode) ...@@ -46,8 +46,8 @@ static int flush_racache(struct inode *inode)
* Post and wait for the I/O upcall to finish * Post and wait for the I/O upcall to finish
*/ */
ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode, ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode,
loff_t *offset, struct iov_iter *iter, loff_t *offset, struct iov_iter *iter, size_t total_size,
size_t total_size, loff_t readahead_size) loff_t readahead_size, struct orangefs_write_range *wr)
{ {
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
struct orangefs_khandle *handle = &orangefs_inode->refn.khandle; struct orangefs_khandle *handle = &orangefs_inode->refn.khandle;
...@@ -85,6 +85,10 @@ ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode, ...@@ -85,6 +85,10 @@ ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode,
new_op->upcall.req.io.buf_index = buffer_index; new_op->upcall.req.io.buf_index = buffer_index;
new_op->upcall.req.io.count = total_size; new_op->upcall.req.io.count = total_size;
new_op->upcall.req.io.offset = *offset; new_op->upcall.req.io.offset = *offset;
if (type == ORANGEFS_IO_WRITE && wr) {
new_op->upcall.uid = from_kuid(&init_user_ns, wr->uid);
new_op->upcall.gid = from_kgid(&init_user_ns, wr->gid);
}
gossip_debug(GOSSIP_FILE_DEBUG, gossip_debug(GOSSIP_FILE_DEBUG,
"%s(%pU): offset: %llu total_size: %zd\n", "%s(%pU): offset: %llu total_size: %zd\n",
...@@ -329,7 +333,7 @@ static vm_fault_t orangefs_fault(struct vm_fault *vmf) ...@@ -329,7 +333,7 @@ static vm_fault_t orangefs_fault(struct vm_fault *vmf)
static const struct vm_operations_struct orangefs_file_vm_ops = { static const struct vm_operations_struct orangefs_file_vm_ops = {
.fault = orangefs_fault, .fault = orangefs_fault,
.map_pages = filemap_map_pages, .map_pages = filemap_map_pages,
.page_mkwrite = filemap_page_mkwrite, .page_mkwrite = orangefs_page_mkwrite,
}; };
/* /*
......
This diff is collapsed.
...@@ -230,6 +230,13 @@ struct orangefs_cached_xattr { ...@@ -230,6 +230,13 @@ struct orangefs_cached_xattr {
unsigned long timeout; unsigned long timeout;
}; };
struct orangefs_write_range {
loff_t pos;
size_t len;
kuid_t uid;
kgid_t gid;
};
extern struct orangefs_stats orangefs_stats; extern struct orangefs_stats orangefs_stats;
/* /*
...@@ -342,6 +349,7 @@ void fsid_key_table_finalize(void); ...@@ -342,6 +349,7 @@ void fsid_key_table_finalize(void);
/* /*
* defined in inode.c * defined in inode.c
*/ */
vm_fault_t orangefs_page_mkwrite(struct vm_fault *);
struct inode *orangefs_new_inode(struct super_block *sb, struct inode *orangefs_new_inode(struct super_block *sb,
struct inode *dir, struct inode *dir,
int mode, int mode,
...@@ -383,7 +391,7 @@ bool __is_daemon_in_service(void); ...@@ -383,7 +391,7 @@ bool __is_daemon_in_service(void);
* defined in file.c * defined in file.c
*/ */
ssize_t wait_for_direct_io(enum ORANGEFS_io_type, struct inode *, loff_t *, ssize_t wait_for_direct_io(enum ORANGEFS_io_type, struct inode *, loff_t *,
struct iov_iter *, size_t, loff_t); struct iov_iter *, size_t, loff_t, struct orangefs_write_range *);
ssize_t do_readv_writev(enum ORANGEFS_io_type, struct file *, loff_t *, ssize_t do_readv_writev(enum ORANGEFS_io_type, struct file *, loff_t *,
struct iov_iter *); struct iov_iter *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment