bcachefs: Run btree key cache shrinker less aggressively
[linux-block.git] / fs / smb / client / cifsglob.h
index 02082621d8e07a8682095516d94f440728a74f76..6ffbd81bd109a0acf71f1ed1e60146c6538e1384 100644 (file)
@@ -650,6 +650,7 @@ struct TCP_Server_Info {
        bool noautotune;                /* do not autotune send buf sizes */
        bool nosharesock;
        bool tcp_nodelay;
+       bool terminate;
        unsigned int credits;  /* send no more requests at once */
        unsigned int max_credits; /* can override large 32000 default at mnt */
        unsigned int in_flight;  /* number of requests on the wire to server */
@@ -969,6 +970,8 @@ struct cifs_server_iface {
        struct list_head iface_head;
        struct kref refcount;
        size_t speed;
+       size_t weight_fulfilled;
+       unsigned int num_channels;
        unsigned int rdma_capable : 1;
        unsigned int rss_capable : 1;
        unsigned int is_active : 1; /* unset if non existent */
@@ -1050,6 +1053,7 @@ struct cifs_ses {
        spinlock_t chan_lock;
        /* ========= begin: protected by chan_lock ======== */
 #define CIFS_MAX_CHANNELS 16
+#define CIFS_INVAL_CHAN_INDEX (-1)
 #define CIFS_ALL_CHANNELS_SET(ses)     \
        ((1UL << (ses)->chan_count) - 1)
 #define CIFS_ALL_CHANS_GOOD(ses)               \
@@ -2143,6 +2147,7 @@ static inline int cifs_get_num_sgs(const struct smb_rqst *rqst,
        unsigned int len, skip;
        unsigned int nents = 0;
        unsigned long addr;
+       size_t data_size;
        int i, j;
 
        /*
@@ -2158,17 +2163,21 @@ static inline int cifs_get_num_sgs(const struct smb_rqst *rqst,
         * rqst[1+].rq_iov[0+] data to be encrypted/decrypted
         */
        for (i = 0; i < num_rqst; i++) {
+               data_size = iov_iter_count(&rqst[i].rq_iter);
+
                /* We really don't want a mixture of pinned and unpinned pages
                 * in the sglist.  It's hard to keep track of which is what.
                 * Instead, we convert to a BVEC-type iterator higher up.
                 */
-               if (WARN_ON_ONCE(user_backed_iter(&rqst[i].rq_iter)))
+               if (data_size &&
+                   WARN_ON_ONCE(user_backed_iter(&rqst[i].rq_iter)))
                        return -EIO;
 
                /* We also don't want to have any extra refs or pins to clean
                 * up in the sglist.
                 */
-               if (WARN_ON_ONCE(iov_iter_extract_will_pin(&rqst[i].rq_iter)))
+               if (data_size &&
+                   WARN_ON_ONCE(iov_iter_extract_will_pin(&rqst[i].rq_iter)))
                        return -EIO;
 
                for (j = 0; j < rqst[i].rq_nvec; j++) {
@@ -2184,7 +2193,8 @@ static inline int cifs_get_num_sgs(const struct smb_rqst *rqst,
                        }
                        skip = 0;
                }
-               nents += iov_iter_npages(&rqst[i].rq_iter, INT_MAX);
+               if (data_size)
+                       nents += iov_iter_npages(&rqst[i].rq_iter, INT_MAX);
        }
        nents += DIV_ROUND_UP(offset_in_page(sig) + SMB2_SIGNATURE_SIZE, PAGE_SIZE);
        return nents;