From patchwork Mon Jun 11 10:46:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saugata Das X-Patchwork-Id: 9185 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9303C23E4F for ; Mon, 11 Jun 2012 10:46:26 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 40AC6A1807D for ; Mon, 11 Jun 2012 10:46:26 +0000 (UTC) Received: by yenq6 with SMTP id q6so2558876yen.11 for ; Mon, 11 Jun 2012 03:46:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=3KvD7R8wnAExiU2/zXwrv4jtyCdZf/8iAyYKJ38EP+s=; b=CWttPG5RE/kdlaOxo4fkPG33Zgzn9ORENwMKrTU4clD5xOUV3Q73wFnv8Ty+9ueshq LpHm+BVCMh/m9/3lxxDTaC90xldtVMEJQr7OF7SFMKOOo95tFsKjgOaHUc4bCpMDxAaG RQAg+Kdf4BXqr/MlE6TrUsgRZ+mkp3Us7b+w7B6/nQpZDjFvGlKsdOWrlUvkAKXGFiJl syMC+1WJsvT3E7SUaHyxz7O1h71NOJLq8XxXItuulrof7jQaTwr0GCLWDUfeLDEJBmui DbcWxHmlisYbrihHeCNn5wYRGWyzJmgZAKQGT0YYSpHbgrDSCO1AI6lSZJ3tXKr6Qo7z hC3g== Received: by 10.50.87.227 with SMTP id bb3mr5802657igb.57.1339411585517; Mon, 11 Jun 2012 03:46:25 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp100692ibb; Mon, 11 Jun 2012 03:46:24 -0700 (PDT) Received: by 10.14.53.77 with SMTP id f53mr5492759eec.88.1339411584300; Mon, 11 Jun 2012 03:46:24 -0700 (PDT) Received: from eu1sys200aog104.obsmtp.com (eu1sys200aog104.obsmtp.com. [207.126.144.117]) by mx.google.com with SMTP id z5si7294677eem.144.2012.06.11.03.46.21 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 03:46:24 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.117 is neither permitted nor denied by best guess record for domain of saugata.das@stericsson.com) client-ip=207.126.144.117; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.117 is neither permitted nor denied by best guess record for domain of saugata.das@stericsson.com) smtp.mail=saugata.das@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob104.postini.com ([207.126.147.11]) with SMTP ID DSNKT9XMfXQH+3/gAWi9ItxCTtanrQVpIZY4@postini.com; Mon, 11 Jun 2012 10:46:24 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 53270103; Mon, 11 Jun 2012 10:46:18 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F0C4F27FF; Mon, 11 Jun 2012 10:46:17 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id B345F24C2F0; Mon, 11 Jun 2012 12:46:11 +0200 (CEST) Received: from localhost (10.201.54.119) by exdcvycastm022.EQ1STM.local (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 11 Jun 2012 12:46:17 +0200 From: Saugata Das To: , , Cc: , , Saugata Das Subject: [PATCH 1/3] block: Context support Date: Mon, 11 Jun 2012 16:16:00 +0530 Message-ID: <1339411562-17100-1-git-send-email-saugata.das@stericsson.com> X-Mailer: git-send-email 1.7.4.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnoqnyYOE5TnjZBdKnOtmAfrt/Y1tHWK/lj9ZZeHI1QQDO52xi/maaLCO8RbIZVt+KVQ1ws From: Saugata Das On eMMC and UFS devices there is a new feature of setting context with each read or write. The idea is to classify the data from different files and apply the realibility on the complete file instead of individual writes, which helps in performance. A new address space operation has been a added to get the context from file system and set up the bi_context field in bio. Then we need to ensure that bio from different contexts are not merged. The context is then passed to the underlying driver as part of the read or write request. Since the number of MMC contexts is limited, multiple file system contexts are mapped to single MMC context. Signed-off-by: Saugata Das --- block/blk-core.c | 1 + block/blk-merge.c | 3 +++ fs/mpage.c | 12 ++++++++++++ include/linux/blk_types.h | 1 + include/linux/blkdev.h | 1 + include/linux/buffer_head.h | 2 ++ include/linux/fs.h | 1 + 7 files changed, 21 insertions(+), 0 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 1f61b74..274e05d 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1309,6 +1309,7 @@ void init_request_from_bio(struct request *req, struct bio *bio) req->errors = 0; req->__sector = bio->bi_sector; req->ioprio = bio_prio(bio); + req->context = bio->bi_context; blk_rq_bio_prep(req->q, req, bio); } diff --git a/block/blk-merge.c b/block/blk-merge.c index 160035f..ed70d56 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -497,6 +497,9 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) if (bio_integrity(bio) != blk_integrity_rq(rq)) return false; + if (bio->bi_context != rq->bio->bi_context) + return false; + return true; } diff --git a/fs/mpage.c b/fs/mpage.c index 0face1c..4889842 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -293,6 +293,12 @@ alloc_new: goto confused; } + if (page && page->mapping && page->mapping->a_ops && + page->mapping->a_ops->get_context) + bio->bi_context = page->mapping->a_ops->get_context(page); + else + bio->bi_context = 0; + length = first_hole << blkbits; if (bio_add_page(bio, page, length, 0) < length) { bio = mpage_bio_submit(READ, bio); @@ -581,6 +587,12 @@ alloc_new: goto confused; } + if (page && page->mapping && page->mapping->a_ops && + page->mapping->a_ops->get_context) + bio->bi_context = page->mapping->a_ops->get_context(page); + else + bio->bi_context = 0; + /* * Must try to add the page before marking the buffer clean or * the confused fail path above (OOM) will be very confused when diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 4053cbd..f3ac448 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -42,6 +42,7 @@ struct bio { unsigned short bi_vcnt; /* how many bio_vec's */ unsigned short bi_idx; /* current index into bvl_vec */ + unsigned long bi_context; /* context of this bio */ /* Number of segments in this BIO after * physical address coalescing is performed. diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2aa2466..0dd9a08 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -167,6 +167,7 @@ struct request { struct list_head timeout_list; unsigned int timeout; int retries; + unsigned long context; /* context of this request */ /* * completion callback. diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 13bba17..0776564 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -72,6 +72,8 @@ struct buffer_head { struct list_head b_assoc_buffers; /* associated with another mapping */ struct address_space *b_assoc_map; /* mapping this buffer is associated with */ + unsigned long b_context; /* context for this buffer within the + storage device */ atomic_t b_count; /* users using this buffer_head */ }; diff --git a/include/linux/fs.h b/include/linux/fs.h index 8de6755..4b379d8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -626,6 +626,7 @@ struct address_space_operations { int (*is_partially_uptodate) (struct page *, read_descriptor_t *, unsigned long); int (*error_remove_page)(struct address_space *, struct page *); + int (*get_context)(struct page *); }; extern const struct address_space_operations empty_aops;