aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2ops.c
diff options
context:
space:
mode:
authorSteven French <smfrench@gmail.com>2013-10-09 21:55:53 -0400
committerSteve French <smfrench@gmail.com>2013-11-02 13:52:41 -0400
commitaf6a12ea8d4bb39a87527835b943bde4215897e5 (patch)
treea237a3054cd667520b22e4bf27009a1f36e79160 /fs/cifs/smb2ops.c
parent2167114c6ea6e76fd84e368bae5389d37dd156aa (diff)
Query File System Alignment
In SMB3 it is now possible to query the file system alignment info, and the preferred (for performance) sector size and whether the underlying disk has no seek penalty (like SSD). Query this information at mount time for SMB3, and make it visible in /proc/fs/cifs/DebugData for debugging purposes. This alignment information and preferred sector size info will be helpful for the copy offload patches to setup the right chunks in the CopyChunk requests. Presumably the knowledge that the underlying disk is SSD could also help us make better readahead and writebehind decisions (something to look at in the future). Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r--fs/cifs/smb2ops.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 79084d67f3fb..25759c89619a 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -210,6 +210,36 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
210} 210}
211 211
212static void 212static void
213smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
214{
215 int rc;
216 __le16 srch_path = 0; /* Null - open root of share */
217 u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
218 struct cifs_open_parms oparms;
219 struct cifs_fid fid;
220
221 oparms.tcon = tcon;
222 oparms.desired_access = FILE_READ_ATTRIBUTES;
223 oparms.disposition = FILE_OPEN;
224 oparms.create_options = 0;
225 oparms.fid = &fid;
226 oparms.reconnect = false;
227
228 rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL);
229 if (rc)
230 return;
231
232 SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
233 FS_ATTRIBUTE_INFORMATION);
234 SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
235 FS_DEVICE_INFORMATION);
236 SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
237 FS_SECTOR_SIZE_INFORMATION); /* SMB3 specific */
238 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
239 return;
240}
241
242static void
213smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) 243smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
214{ 244{
215 int rc; 245 int rc;
@@ -332,7 +362,19 @@ smb2_dump_share_caps(struct seq_file *m, struct cifs_tcon *tcon)
332 seq_puts(m, " ASYMMETRIC,"); 362 seq_puts(m, " ASYMMETRIC,");
333 if (tcon->capabilities == 0) 363 if (tcon->capabilities == 0)
334 seq_puts(m, " None"); 364 seq_puts(m, " None");
365 if (tcon->ss_flags & SSINFO_FLAGS_ALIGNED_DEVICE)
366 seq_puts(m, " Aligned,");
367 if (tcon->ss_flags & SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE)
368 seq_puts(m, " Partition Aligned,");
369 if (tcon->ss_flags & SSINFO_FLAGS_NO_SEEK_PENALTY)
370 seq_puts(m, " SSD,");
371 if (tcon->ss_flags & SSINFO_FLAGS_TRIM_ENABLED)
372 seq_puts(m, " TRIM-support,");
373
335 seq_printf(m, "\tShare Flags: 0x%x", tcon->share_flags); 374 seq_printf(m, "\tShare Flags: 0x%x", tcon->share_flags);
375 if (tcon->perf_sector_size)
376 seq_printf(m, "\tOptimal sector size: 0x%x",
377 tcon->perf_sector_size);
336} 378}
337 379
338static void 380static void
@@ -1048,7 +1090,7 @@ struct smb_version_operations smb30_operations = {
1048 .logoff = SMB2_logoff, 1090 .logoff = SMB2_logoff,
1049 .tree_connect = SMB2_tcon, 1091 .tree_connect = SMB2_tcon,
1050 .tree_disconnect = SMB2_tdis, 1092 .tree_disconnect = SMB2_tdis,
1051 .qfs_tcon = smb2_qfs_tcon, 1093 .qfs_tcon = smb3_qfs_tcon,
1052 .is_path_accessible = smb2_is_path_accessible, 1094 .is_path_accessible = smb2_is_path_accessible,
1053 .can_echo = smb2_can_echo, 1095 .can_echo = smb2_can_echo,
1054 .echo = SMB2_echo, 1096 .echo = SMB2_echo,