staging/lustre: Get rid of CFS_PAGE_MASK
authorOleg Drokin <green@linuxhacker.ru>
Wed, 30 Mar 2016 23:48:23 +0000 (19:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Mar 2016 04:38:13 +0000 (21:38 -0700)
CFS_PAGE_MASK is the same as PAGE_MASK, so get rid of it.

We are replacing it with PAGE_MASK instead of PAGE_CACHE_MASK
because PAGE_CACHE_* stuff is apparently going away.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 files changed:
drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
drivers/staging/lustre/lnet/selftest/brw_test.c
drivers/staging/lustre/lustre/llite/llite_mmap.c
drivers/staging/lustre/lustre/llite/rw26.c
drivers/staging/lustre/lustre/llite/vvp_io.c
drivers/staging/lustre/lustre/lmv/lmv_obd.c
drivers/staging/lustre/lustre/obdclass/class_obd.c
drivers/staging/lustre/lustre/obdecho/echo_client.c
drivers/staging/lustre/lustre/osc/osc_cache.c
drivers/staging/lustre/lustre/osc/osc_request.c
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
drivers/staging/lustre/lustre/ptlrpc/sec_plain.c

index 0f2fd79e5ec8bef0bdab7c4f1dc77bff0b06e2f7..448379b2a01ec15f824b5900a5b6124808462d6a 100644 (file)
@@ -57,7 +57,6 @@
 #include "../libcfs_cpu.h"
 #endif
 
-#define CFS_PAGE_MASK             (~((__u64)PAGE_CACHE_SIZE-1))
 #define page_index(p)       ((p)->index)
 
 #define memory_pressure_get() (current->flags & PF_MEMALLOC)
index 0715101c577c9dc7171234682fd061677ecca924..84f9b7b4758115fcbb5d914c34a929efbc25bfe6 100644 (file)
@@ -227,7 +227,7 @@ int cfs_crypto_hash_update_page(struct cfs_crypto_hash_desc *hdesc,
        struct scatterlist sl;
 
        sg_init_table(&sl, 1);
-       sg_set_page(&sl, page, len, offset & ~CFS_PAGE_MASK);
+       sg_set_page(&sl, page, len, offset & ~PAGE_MASK);
 
        ahash_request_set_crypt(req, &sl, NULL, sl.length);
        return crypto_ahash_update(req);
index b33c35694eb1f3bddb6e00d479a3f59da7a2ad3e..1988cee367516f58e56f4d4fa9b2c5a7e795630f 100644 (file)
@@ -457,7 +457,7 @@ brw_server_handle(struct srpc_server_rpc *rpc)
 
        if (!(reqstmsg->msg_ses_feats & LST_FEAT_BULK_LEN)) {
                /* compat with old version */
-               if (reqst->brw_len & ~CFS_PAGE_MASK) {
+               if (reqst->brw_len & ~PAGE_MASK) {
                        reply->brw_status = EINVAL;
                        return 0;
                }
index 69445a9f201196b257ea91c325494c184ba3cdc8..baccf9379ca72355782e255d7c3acfc08bf1fcd0 100644 (file)
@@ -57,10 +57,10 @@ void policy_from_vma(ldlm_policy_data_t *policy,
                     struct vm_area_struct *vma, unsigned long addr,
                     size_t count)
 {
-       policy->l_extent.start = ((addr - vma->vm_start) & CFS_PAGE_MASK) +
+       policy->l_extent.start = ((addr - vma->vm_start) & PAGE_MASK) +
                                 (vma->vm_pgoff << PAGE_CACHE_SHIFT);
        policy->l_extent.end = (policy->l_extent.start + count - 1) |
-                              ~CFS_PAGE_MASK;
+                              ~PAGE_MASK;
 }
 
 struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
index 7a5db67bc68085e7749ec9238c01bda3c822ba33..3d7e64ee982465f641ee670971ef4e11538ab432 100644 (file)
@@ -376,7 +376,7 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter,
                return -EBADF;
 
        /* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */
-       if ((file_offset & ~CFS_PAGE_MASK) || (count & ~CFS_PAGE_MASK))
+       if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK))
                return -EINVAL;
 
        CDEBUG(D_VFSTRACE,
@@ -386,7 +386,7 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter,
               MAX_DIO_SIZE >> PAGE_CACHE_SHIFT);
 
        /* Check that all user buffers are aligned as well */
-       if (iov_iter_alignment(iter) & ~CFS_PAGE_MASK)
+       if (iov_iter_alignment(iter) & ~PAGE_MASK)
                return -EINVAL;
 
        env = cl_env_get(&refcheck);
@@ -435,8 +435,8 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter,
                            size > (PAGE_CACHE_SIZE / sizeof(*pages)) *
                                   PAGE_CACHE_SIZE) {
                                size = ((((size / 2) - 1) |
-                                        ~CFS_PAGE_MASK) + 1) &
-                                       CFS_PAGE_MASK;
+                                        ~PAGE_MASK) + 1) &
+                                       PAGE_MASK;
                                CDEBUG(D_VFSTRACE, "DIO size now %lu\n",
                                       size);
                                continue;
index fb0c26ee7ff3a58d6adc3c25adfc2cfd61c09169..984699a32c694136ea7cbe5d2ea07c6024d1f36f 100644 (file)
@@ -234,8 +234,8 @@ static int vvp_mmap_locks(const struct lu_env *env,
                if (count == 0)
                        continue;
 
-               count += addr & (~CFS_PAGE_MASK);
-               addr &= CFS_PAGE_MASK;
+               count += addr & (~PAGE_MASK);
+               addr &= PAGE_MASK;
 
                down_read(&mm->mmap_sem);
                while ((vma = our_vma(mm, addr, count)) != NULL) {
@@ -1043,7 +1043,7 @@ static int vvp_io_commit_write(const struct lu_env *env,
                                to = PAGE_CACHE_SIZE;
                                need_clip = false;
                        } else if (last_index == pg->cp_index) {
-                               int size_to = i_size_read(inode) & ~CFS_PAGE_MASK;
+                               int size_to = i_size_read(inode) & ~PAGE_MASK;
 
                                if (to < size_to)
                                        to = size_to;
index 0f776cf8a5aa37e237516237b6ada6da3823b393..e3a721670ca190d6fa3ddf5e31b920717f0b918d 100644 (file)
@@ -2071,7 +2071,7 @@ static void lmv_adjust_dirpages(struct page **pages, int ncfspgs, int nlupgs)
                        dp = (struct lu_dirpage *)((char *)dp + LU_PAGE_SIZE);
 
                        /* Check if we've reached the end of the CFS_PAGE. */
-                       if (!((unsigned long)dp & ~CFS_PAGE_MASK))
+                       if (!((unsigned long)dp & ~PAGE_MASK))
                                break;
 
                        /* Save the hash and flags of this lu_dirpage. */
index 1a938e1376f94df46e2b66366fdfc655b35f1c17..d9844ba8b9be9046e315baa0aaf96ef1ea5dd5aa 100644 (file)
@@ -461,7 +461,7 @@ static int obd_init_checks(void)
                CWARN("LPD64 wrong length! strlen(%s)=%d != 2\n", buf, len);
                ret = -EINVAL;
        }
-       if ((u64val & ~CFS_PAGE_MASK) >= PAGE_CACHE_SIZE) {
+       if ((u64val & ~PAGE_MASK) >= PAGE_CACHE_SIZE) {
                CWARN("mask failed: u64val %llu >= %llu\n", u64val,
                      (__u64)PAGE_CACHE_SIZE);
                ret = -EINVAL;
index 64ffe243f87013e0e52be3e5fa2903aba4291816..33ce0c80e4b2995e4bc4396fdc067b070420457d 100644 (file)
@@ -1119,7 +1119,7 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
        int rc;
        int i;
 
-       LASSERT((offset & ~CFS_PAGE_MASK) == 0);
+       LASSERT((offset & ~PAGE_MASK) == 0);
        LASSERT(ed->ed_next);
        env = cl_env_get(&refcheck);
        if (IS_ERR(env))
@@ -1387,7 +1387,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa,
        LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ);
 
        if (count <= 0 ||
-           (count & (~CFS_PAGE_MASK)) != 0)
+           (count & (~PAGE_MASK)) != 0)
                return -EINVAL;
 
        /* XXX think again with misaligned I/O */
@@ -1470,7 +1470,7 @@ static int echo_client_prep_commit(const struct lu_env *env,
        u64 npages, tot_pages;
        int i, ret = 0, brw_flags = 0;
 
-       if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0)
+       if (count <= 0 || (count & (~PAGE_MASK)) != 0)
                return -EINVAL;
 
        npages = batch >> PAGE_CACHE_SHIFT;
index 63363111380cbdfdb500067d4d9b7a800fcb3c65..3cfd2b09f760163416bfab43b66806ae2ac1e5eb 100644 (file)
@@ -877,7 +877,7 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext,
                 * span a whole chunk on the OST side, or our accounting goes
                 * wrong.  Should match the code in filter_grant_check.
                 */
-               int offset = oap->oap_page_off & ~CFS_PAGE_MASK;
+               int offset = oap->oap_page_off & ~PAGE_MASK;
                int count = oap->oap_count + (offset & (blocksize - 1));
                int end = (offset + oap->oap_count) & (blocksize - 1);
 
@@ -2238,7 +2238,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
 
        oap->oap_page = page;
        oap->oap_obj_off = offset;
-       LASSERT(!(offset & ~CFS_PAGE_MASK));
+       LASSERT(!(offset & ~PAGE_MASK));
 
        if (!client_is_remote(exp) && capable(CFS_CAP_SYS_RESOURCE))
                oap->oap_brw_flags = OBD_BRW_NOQUOTA;
index ec0287feb3cef917e541e864d521fc3d3f9c62a2..850d5dd49831923cfeed2e9ac5dd826c155ffb5c 100644 (file)
@@ -1082,7 +1082,7 @@ static void handle_short_read(int nob_read, u32 page_count,
                if (pga[i]->count > nob_read) {
                        /* EOF inside this page */
                        ptr = kmap(pga[i]->pg) +
-                               (pga[i]->off & ~CFS_PAGE_MASK);
+                               (pga[i]->off & ~PAGE_MASK);
                        memset(ptr + nob_read, 0, pga[i]->count - nob_read);
                        kunmap(pga[i]->pg);
                        page_count--;
@@ -1097,7 +1097,7 @@ static void handle_short_read(int nob_read, u32 page_count,
 
        /* zero remaining pages */
        while (page_count-- > 0) {
-               ptr = kmap(pga[i]->pg) + (pga[i]->off & ~CFS_PAGE_MASK);
+               ptr = kmap(pga[i]->pg) + (pga[i]->off & ~PAGE_MASK);
                memset(ptr, 0, pga[i]->count);
                kunmap(pga[i]->pg);
                i++;
@@ -1188,20 +1188,20 @@ static u32 osc_checksum_bulk(int nob, u32 pg_count,
                if (i == 0 && opc == OST_READ &&
                    OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE)) {
                        unsigned char *ptr = kmap(pga[i]->pg);
-                       int off = pga[i]->off & ~CFS_PAGE_MASK;
+                       int off = pga[i]->off & ~PAGE_MASK;
 
                        memcpy(ptr + off, "bad1", min(4, nob));
                        kunmap(pga[i]->pg);
                }
                cfs_crypto_hash_update_page(hdesc, pga[i]->pg,
-                                           pga[i]->off & ~CFS_PAGE_MASK,
+                                           pga[i]->off & ~PAGE_MASK,
                                  count);
                CDEBUG(D_PAGE,
                       "page %p map %p index %lu flags %lx count %u priv %0lx: off %d\n",
                       pga[i]->pg, pga[i]->pg->mapping, pga[i]->pg->index,
                       (long)pga[i]->pg->flags, page_count(pga[i]->pg),
                       page_private(pga[i]->pg),
-                      (int)(pga[i]->off & ~CFS_PAGE_MASK));
+                      (int)(pga[i]->off & ~PAGE_MASK));
 
                nob -= pga[i]->count;
                pg_count--;
@@ -1309,7 +1309,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
        pg_prev = pga[0];
        for (requested_nob = i = 0; i < page_count; i++, niobuf++) {
                struct brw_page *pg = pga[i];
-               int poff = pg->off & ~CFS_PAGE_MASK;
+               int poff = pg->off & ~PAGE_MASK;
 
                LASSERT(pg->count > 0);
                /* make sure there is no gap in the middle of page array */
@@ -2227,8 +2227,8 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
        /* Filesystem lock extents are extended to page boundaries so that
         * dealing with the page cache is a little smoother.
         */
-       policy->l_extent.start -= policy->l_extent.start & ~CFS_PAGE_MASK;
-       policy->l_extent.end |= ~CFS_PAGE_MASK;
+       policy->l_extent.start -= policy->l_extent.start & ~PAGE_MASK;
+       policy->l_extent.end |= ~PAGE_MASK;
 
        /*
         * kms is not valid when either object is completely fresh (so that no
@@ -2378,8 +2378,8 @@ int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id,
        /* Filesystem lock extents are extended to page boundaries so that
         * dealing with the page cache is a little smoother
         */
-       policy->l_extent.start -= policy->l_extent.start & ~CFS_PAGE_MASK;
-       policy->l_extent.end |= ~CFS_PAGE_MASK;
+       policy->l_extent.start -= policy->l_extent.start & ~PAGE_MASK;
+       policy->l_extent.end |= ~PAGE_MASK;
 
        /* Next, search for already existing extent locks that will cover us */
        /* If we're trying to read, we also search for an existing PW lock.  The
@@ -2784,7 +2784,7 @@ out:
                        goto skip_locking;
 
                policy.l_extent.start = fm_key->fiemap.fm_start &
-                                               CFS_PAGE_MASK;
+                                               PAGE_MASK;
 
                if (OBD_OBJECT_EOF - fm_key->fiemap.fm_length <=
                    fm_key->fiemap.fm_start + PAGE_CACHE_SIZE - 1)
@@ -2792,7 +2792,7 @@ out:
                else
                        policy.l_extent.end = (fm_key->fiemap.fm_start +
                                fm_key->fiemap.fm_length +
-                               PAGE_CACHE_SIZE - 1) & CFS_PAGE_MASK;
+                               PAGE_CACHE_SIZE - 1) & PAGE_MASK;
 
                ostid_build_res_name(&fm_key->oa.o_oi, &res_id);
                mode = ldlm_lock_match(exp->exp_obd->obd_namespace,
index 54a0c1ff7b20081e64c0b1367ae670da54fbb13d..33d141149afd220cfd903aa442454d746150fff5 100644 (file)
@@ -527,7 +527,7 @@ int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,
 
        for (i = 0; i < desc->bd_iov_count; i++) {
                cfs_crypto_hash_update_page(hdesc, desc->bd_iov[i].kiov_page,
-                                 desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK,
+                                 desc->bd_iov[i].kiov_offset & ~PAGE_MASK,
                                  desc->bd_iov[i].kiov_len);
        }
 
index 6276bf59c3aa558aeb2d9bb4c4e92182b0f9275b..37c9f4c453de0128f6329648f77b09d6a337693c 100644 (file)
@@ -162,7 +162,7 @@ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
                        continue;
 
                ptr = kmap(desc->bd_iov[i].kiov_page);
-               off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
+               off = desc->bd_iov[i].kiov_offset & ~PAGE_MASK;
                ptr[off] ^= 0x1;
                kunmap(desc->bd_iov[i].kiov_page);
                return;