Whamcloud - gitweb
LU-1757 brw: add short io osc/ost transfer.
[fs/lustre-release.git] / lustre / llite / llite_lib.c
index 87159a0..6071d49 100644 (file)
@@ -99,8 +99,7 @@ static struct ll_sb_info *ll_init_sbi(void)
        sbi->ll_ra_info.ra_max_pages_per_file = min(pages / 32,
                                           SBI_DEFAULT_READAHEAD_MAX);
        sbi->ll_ra_info.ra_max_pages = sbi->ll_ra_info.ra_max_pages_per_file;
-       sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
-                                          SBI_DEFAULT_READAHEAD_WHOLE_MAX;
+       sbi->ll_ra_info.ra_max_read_ahead_whole_pages = -1;
 
         ll_generate_random_uuid(uuid);
         class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
@@ -259,7 +258,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        if (sbi->ll_flags & LL_SBI_ALWAYS_PING)
                data->ocd_connect_flags &= ~OBD_CONNECT_PINGLESS;
 
-#ifdef HAVE_SECURITY_DENTRY_INIT_SECURITY
+#if defined(HAVE_SECURITY_DENTRY_INIT_SECURITY) && defined(CONFIG_SECURITY)
        data->ocd_connect_flags2 |= OBD_CONNECT2_FILE_SECCTX;
 #endif /* HAVE_SECURITY_DENTRY_INIT_SECURITY */
 
@@ -400,7 +399,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                  OBD_CONNECT_JOBSTATS | OBD_CONNECT_LVB_TYPE |
                                  OBD_CONNECT_LAYOUTLOCK |
                                  OBD_CONNECT_PINGLESS | OBD_CONNECT_LFSCK |
-                                 OBD_CONNECT_BULK_MBITS |
+                                 OBD_CONNECT_BULK_MBITS | OBD_CONNECT_SHORTIO |
                                  OBD_CONNECT_FLAGS2;
 
 /* The client currently advertises support for OBD_CONNECT_LOCKAHEAD_OLD so it
@@ -467,6 +466,12 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 
        sbi->ll_dt_exp->exp_connect_data = *data;
 
+       /* Don't change value if it was specified in the config log */
+       if (sbi->ll_ra_info.ra_max_read_ahead_whole_pages == -1)
+               sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
+                       max_t(unsigned long, SBI_DEFAULT_READAHEAD_WHOLE_MAX,
+                             (data->ocd_brw_size >> PAGE_SHIFT));
+
        err = obd_fid_init(sbi->ll_dt_exp->exp_obd, sbi->ll_dt_exp,
                           LUSTRE_SEQ_METADATA);
        if (err) {
@@ -943,14 +948,41 @@ void ll_lli_init(struct ll_inode_info *lli)
        memset(lli->lli_jobid, 0, LUSTRE_JOBID_SIZE);
 }
 
-static inline int ll_bdi_register(struct backing_dev_info *bdi)
+#ifndef HAVE_SUPER_SETUP_BDI_NAME
+
+#define LSI_BDI_INITIALIZED    0x00400000
+
+#ifndef HAVE_BDI_CAP_MAP_COPY
+# define BDI_CAP_MAP_COPY      0
+#endif
+
+#define MAX_STRING_SIZE 128
+
+static int super_setup_bdi_name(struct super_block *sb, char *fmt, ...)
 {
-       static atomic_t ll_bdi_num = ATOMIC_INIT(0);
+       struct  lustre_sb_info *lsi = s2lsi(sb);
+       char buf[MAX_STRING_SIZE];
+       va_list args;
+       int err;
+
+       err = bdi_init(&lsi->lsi_bdi);
+       if (err)
+               return err;
+
+       lsi->lsi_flags |= LSI_BDI_INITIALIZED;
+       lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
+       lsi->lsi_bdi.name = "lustre";
+       va_start(args, fmt);
+       vsnprintf(buf, MAX_STRING_SIZE, fmt, args);
+       va_end(args);
+       err = bdi_register(&lsi->lsi_bdi, NULL, "%s", buf);
+       va_end(args);
+       if (!err)
+               sb->s_bdi = &lsi->lsi_bdi;
 
-       bdi->name = "lustre";
-       return bdi_register(bdi, NULL, "lustre-%d",
-                           atomic_inc_return(&ll_bdi_num));
+       return err;
 }
+#endif /* !HAVE_SUPER_SETUP_BDI_NAME */
 
 int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
 {
@@ -987,20 +1019,10 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
        if (err)
                GOTO(out_free, err);
 
-       err = bdi_init(&lsi->lsi_bdi);
-       if (err)
-               GOTO(out_free, err);
-       lsi->lsi_flags |= LSI_BDI_INITIALIZED;
-#ifdef HAVE_BDI_CAP_MAP_COPY
-       lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
-#else
-       lsi->lsi_bdi.capabilities = 0;
-#endif
-       err = ll_bdi_register(&lsi->lsi_bdi);
+       err = super_setup_bdi_name(sb, "lustre-%p", sb);
        if (err)
                GOTO(out_free, err);
 
-       sb->s_bdi = &lsi->lsi_bdi;
 #ifndef HAVE_DCACHE_LOCK
        /* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
        sb->s_d_op = &ll_d_ops;
@@ -1142,10 +1164,12 @@ void ll_put_super(struct super_block *sb)
         if (profilenm)
                 class_del_profile(profilenm);
 
+#ifndef HAVE_SUPER_SETUP_BDI_NAME
        if (lsi->lsi_flags & LSI_BDI_INITIALIZED) {
                bdi_destroy(&lsi->lsi_bdi);
                lsi->lsi_flags &= ~LSI_BDI_INITIALIZED;
        }
+#endif
 
         ll_free_sbi(sb);
         lsi->lsi_llsbi = NULL;