Commit 9f8fd53c authored by Martin Brandenburg's avatar Martin Brandenburg Committed by Mike Marshall

orangefs: revamp block sizes

Now the superblock block size is PAGE_SIZE.  The inode block size is
PAGE_SIZE for directories and symlinks, but is the server-reported
block size for regular files.

The block size in the OrangeFS private inode is now deleted.  Stat
now reports PAGE_SIZE for directories and symlinks and the
server-reported block size for regular files.

The user-space visible change is that the block size for directores
and symlinks and the superblock is now PAGE_SIZE rather than the size of
the client-core shared memory buffers, which was typically four
megabytes.
Reported-by: default avatarBecky Ligon <ligon@clemson.edu>
Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
Cc: hubcap@omnibond.com
Cc: walt@omnibond.com
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent b04e2177
...@@ -20,8 +20,8 @@ static int read_one_page(struct page *page) ...@@ -20,8 +20,8 @@ static int read_one_page(struct page *page)
int max_block; int max_block;
ssize_t bytes_read = 0; ssize_t bytes_read = 0;
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
const __u32 blocksize = PAGE_SIZE; /* inode->i_blksize */ const __u32 blocksize = PAGE_SIZE;
const __u32 blockbits = PAGE_SHIFT; /* inode->i_blkbits */ const __u32 blockbits = PAGE_SHIFT;
struct iov_iter to; struct iov_iter to;
struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE}; struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE};
...@@ -262,7 +262,6 @@ int orangefs_getattr(const struct path *path, struct kstat *stat, ...@@ -262,7 +262,6 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
/* override block size reported to stat */ /* override block size reported to stat */
orangefs_inode = ORANGEFS_I(inode); orangefs_inode = ORANGEFS_I(inode);
stat->blksize = orangefs_inode->blksize;
if (request_mask & STATX_SIZE) if (request_mask & STATX_SIZE)
stat->result_mask = STATX_BASIC_STATS; stat->result_mask = STATX_BASIC_STATS;
...@@ -325,7 +324,6 @@ static int orangefs_init_iops(struct inode *inode) ...@@ -325,7 +324,6 @@ static int orangefs_init_iops(struct inode *inode)
case S_IFREG: case S_IFREG:
inode->i_op = &orangefs_file_inode_operations; inode->i_op = &orangefs_file_inode_operations;
inode->i_fop = &orangefs_file_operations; inode->i_fop = &orangefs_file_operations;
inode->i_blkbits = PAGE_SHIFT;
break; break;
case S_IFLNK: case S_IFLNK:
inode->i_op = &orangefs_symlink_inode_operations; inode->i_op = &orangefs_symlink_inode_operations;
......
...@@ -182,7 +182,6 @@ static inline void set_op_state_purged(struct orangefs_kernel_op_s *op) ...@@ -182,7 +182,6 @@ static inline void set_op_state_purged(struct orangefs_kernel_op_s *op)
struct orangefs_inode_s { struct orangefs_inode_s {
struct orangefs_object_kref refn; struct orangefs_object_kref refn;
char link_target[ORANGEFS_NAME_MAX]; char link_target[ORANGEFS_NAME_MAX];
__s64 blksize;
/* /*
* Reading/Writing Extended attributes need to acquire the appropriate * Reading/Writing Extended attributes need to acquire the appropriate
* reader/writer semaphore on the orangefs_inode_s structure. * reader/writer semaphore on the orangefs_inode_s structure.
......
...@@ -275,7 +275,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, ...@@ -275,7 +275,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
{ {
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
struct orangefs_kernel_op_s *new_op; struct orangefs_kernel_op_s *new_op;
loff_t inode_size, rounded_up_size; loff_t inode_size;
int ret, type; int ret, type;
gossip_debug(GOSSIP_UTILS_DEBUG, "%s: called on inode %pU\n", __func__, gossip_debug(GOSSIP_UTILS_DEBUG, "%s: called on inode %pU\n", __func__,
...@@ -330,22 +330,19 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, ...@@ -330,22 +330,19 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
if (request_mask & STATX_SIZE || new) { if (request_mask & STATX_SIZE || new) {
inode_size = (loff_t)new_op-> inode_size = (loff_t)new_op->
downcall.resp.getattr.attributes.size; downcall.resp.getattr.attributes.size;
rounded_up_size =
(inode_size + (4096 - (inode_size % 4096)));
inode->i_size = inode_size; inode->i_size = inode_size;
orangefs_inode->blksize = inode->i_blkbits = ffs(new_op->downcall.resp.getattr.
new_op->downcall.resp.getattr.attributes.blksize; attributes.blksize);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
inode->i_bytes = inode_size; inode->i_bytes = inode_size;
inode->i_blocks = inode->i_blocks =
(unsigned long)(rounded_up_size / 512); (inode_size + 512 - inode_size % 512)/512;
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} }
break; break;
case S_IFDIR: case S_IFDIR:
if (request_mask & STATX_SIZE || new) { if (request_mask & STATX_SIZE || new) {
inode->i_size = PAGE_SIZE; inode->i_size = PAGE_SIZE;
orangefs_inode->blksize = i_blocksize(inode);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
inode_set_bytes(inode, inode->i_size); inode_set_bytes(inode, inode->i_size);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
...@@ -356,7 +353,6 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, ...@@ -356,7 +353,6 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
if (new) { if (new) {
inode->i_size = (loff_t)strlen(new_op-> inode->i_size = (loff_t)strlen(new_op->
downcall.resp.getattr.link_target); downcall.resp.getattr.link_target);
orangefs_inode->blksize = i_blocksize(inode);
ret = strscpy(orangefs_inode->link_target, ret = strscpy(orangefs_inode->link_target,
new_op->downcall.resp.getattr.link_target, new_op->downcall.resp.getattr.link_target,
ORANGEFS_NAME_MAX); ORANGEFS_NAME_MAX);
......
...@@ -423,8 +423,8 @@ static int orangefs_fill_sb(struct super_block *sb, ...@@ -423,8 +423,8 @@ static int orangefs_fill_sb(struct super_block *sb,
sb->s_op = &orangefs_s_ops; sb->s_op = &orangefs_s_ops;
sb->s_d_op = &orangefs_dentry_operations; sb->s_d_op = &orangefs_dentry_operations;
sb->s_blocksize = orangefs_bufmap_size_query(); sb->s_blocksize = PAGE_SIZE;
sb->s_blocksize_bits = orangefs_bufmap_shift_query(); sb->s_blocksize_bits = PAGE_SHIFT;
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
root_object.khandle = ORANGEFS_SB(sb)->root_khandle; root_object.khandle = ORANGEFS_SB(sb)->root_khandle;
......
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