Whamcloud - gitweb
b=20777
authoranserper <anserper>
Tue, 22 Sep 2009 18:04:46 +0000 (18:04 +0000)
committeranserper <anserper>
Tue, 22 Sep 2009 18:04:46 +0000 (18:04 +0000)
i=Johann Lombardi
i=Alexey Lyashkov

cut request per stripe so that individual pages cannot cross page boundaries

lustre/llite/rw26.c
lustre/tests/sanity.sh

index a60f437..b70ed5b 100644 (file)
@@ -227,6 +227,7 @@ ssize_t ll_direct_IO(int rw, struct file *file,
         struct inode *inode = file->f_mapping->host;
         ssize_t count = iov_length(iov, nr_segs);
         ssize_t tot_bytes = 0, result = 0;
+        struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct ll_inode_info *lli = ll_i2info(inode);
         struct lov_stripe_md *lsm = lli->lli_smd;
         struct ptlrpc_request_set *set;
@@ -279,6 +280,20 @@ ssize_t ll_direct_IO(int rw, struct file *file,
                         size_t bytes;
 
                         bytes = min(size,iov_left);
+
+                        /* a dirty hack for non-aligned I/O: avoid filling pgas,
+                         * which cross stripe boundaries (20777)              */
+                        if (user_addr   & ~CFS_PAGE_MASK ||
+                            file_offset & ~CFS_PAGE_MASK) {
+                                obd_off end = file_offset;
+
+                                obd_extent_calc(sbi->ll_osc_exp, lsm,
+                                                OBD_CALC_STRIPE_END, &end);
+
+                                if (file_offset + bytes > end + 1)
+                                        bytes = end - file_offset + 1;
+                        }
+
                         page_count = ll_get_user_pages(rw, user_addr,
                                                        bytes,
                                                        &pages, &max_pages);
index f7e432b..1789969 100644 (file)
@@ -6364,6 +6364,17 @@ test_201c() {    # was 200i
 }
 run_test 201c "Remove a pool ============================================"
 
+test_202() {
+        $LFS setstripe -c 2 -s 1048576 $DIR/$tfile
+        multiop $DIR/$tfile oO_WRONLY:O_APPEND:O_DIRECT:b1048548b130c || \
+                error "direct write failed"
+        multiop $DIR/${tfile}2 oO_WRONLY:O_CREAT:w1048548w130c || \
+                error "cached write failed"
+        cmp $DIR/$tfile $DIR/${tfile}2 || error "cmp failed"
+        rm -f $DIR/${tfile}2
+}
+run_test 202 "O_APPEND+O_DIRECT multistripe write ========================"
+
 #
 # tests that do cleanup/setup should be run at the end
 #