ksmbd: use f_bsize in FS_SECTOR_SIZE_INFORMATION
authorNamjae Jeon <namjae.jeon@samsung.com>
Tue, 22 Jun 2021 07:20:47 +0000 (16:20 +0900)
committerNamjae Jeon <namjae.jeon@samsung.com>
Mon, 28 Jun 2021 07:28:25 +0000 (16:28 +0900)
Use f_bsize in FS_SECTOR_SIZE_INFORMATION to avoid the access the block
layer.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifsd/smb2pdu.c
fs/cifsd/vfs.c
fs/cifsd/vfs.h

index bbb35e6..1327ae8 100644 (file)
@@ -4791,19 +4791,15 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
        case FS_SECTOR_SIZE_INFORMATION:
        {
                struct smb3_fs_ss_info *info;
-               struct ksmbd_fs_sector_size fs_ss;
 
                info = (struct smb3_fs_ss_info *)(rsp->Buffer);
-               ksmbd_vfs_smb2_sector_size(d_inode(path.dentry), &fs_ss);
 
-               info->LogicalBytesPerSector =
-                               cpu_to_le32(fs_ss.logical_sector_size);
+               info->LogicalBytesPerSector = cpu_to_le32(stfs.f_bsize);
                info->PhysicalBytesPerSectorForAtomicity =
-                               cpu_to_le32(fs_ss.physical_sector_size);
-               info->PhysicalBytesPerSectorForPerf =
-                               cpu_to_le32(fs_ss.optimal_io_size);
+                               cpu_to_le32(stfs.f_bsize);
+               info->PhysicalBytesPerSectorForPerf = cpu_to_le32(stfs.f_bsize);
                info->FSEffPhysicalBytesPerSectorForAtomicity =
-                               cpu_to_le32(fs_ss.optimal_io_size);
+                               cpu_to_le32(stfs.f_bsize);
                info->Flags = cpu_to_le32(SSINFO_FLAGS_ALIGNED_DEVICE |
                                    SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE);
                info->ByteOffsetForSectorAlignment = 0;
index 9c594e8..fddabb4 100644 (file)
@@ -1118,37 +1118,6 @@ out:
        return err;
 }
 
-/*
- * ksmbd_vfs_get_smb2_sector_size() - get fs sector sizes
- * @inode: inode
- * @fs_ss: fs sector size struct
- */
-void ksmbd_vfs_smb2_sector_size(struct inode *inode,
-                               struct ksmbd_fs_sector_size *fs_ss)
-{
-       struct request_queue *q;
-
-       fs_ss->logical_sector_size = 512;
-       fs_ss->physical_sector_size = 512;
-       fs_ss->optimal_io_size = 512;
-
-       if (!inode->i_sb->s_bdev)
-               return;
-
-       q = inode->i_sb->s_bdev->bd_disk->queue;
-
-       if (q) {
-               if (q->limits.logical_block_size)
-                       fs_ss->logical_sector_size =
-                               q->limits.logical_block_size;
-               if (q->limits.physical_block_size)
-                       fs_ss->physical_sector_size =
-                               q->limits.physical_block_size;
-               if (q->limits.io_opt)
-                       fs_ss->optimal_io_size = q->limits.io_opt;
-       }
-}
-
 static int __dir_empty(struct dir_context *ctx, const char *name, int namlen,
                       loff_t offset, u64 ino, unsigned int d_type)
 {
index 751bb6e..49f0558 100644 (file)
@@ -192,12 +192,6 @@ struct ksmbd_kstat {
        __le32                  file_attributes;
 };
 
-struct ksmbd_fs_sector_size {
-       unsigned short  logical_sector_size;
-       unsigned int    physical_sector_size;
-       unsigned int    optimal_io_size;
-};
-
 int ksmbd_vfs_inode_permission(struct dentry *dentry, int acc_mode,
                               bool delete);
 int ksmbd_vfs_query_maximal_access(struct dentry *dentry, __le32 *daccess);
@@ -247,8 +241,6 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
                         struct file_allocated_range_buffer *ranges,
                         int in_count, int *out_count);
 int ksmbd_vfs_unlink(struct dentry *dir, struct dentry *dentry);
-void ksmbd_vfs_smb2_sector_size(struct inode *inode,
-                               struct ksmbd_fs_sector_size *fs_ss);
 void *ksmbd_vfs_init_kstat(char **p, struct ksmbd_kstat *ksmbd_kstat);
 int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work, struct dentry *dentry,
                                struct ksmbd_kstat *ksmbd_kstat);