Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753457Ab2H1VoY (ORCPT ); Tue, 28 Aug 2012 17:44:24 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:40836 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753056Ab2H1VoX (ORCPT ); Tue, 28 Aug 2012 17:44:23 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 28 Aug 2012 17:44:22 -0400 Message-ID: Subject: [PATCH 2/2] add discard support to nbd From: Paul Clements To: kernel list Cc: andrew morton Content-Type: multipart/mixed; boundary=20cf3010edad6d43e904c85a588c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4486 Lines: 68 --20cf3010edad6d43e904c85a588c Content-Type: text/plain; charset=ISO-8859-1 --20cf3010edad6d43e904c85a588c Content-Type: application/octet-stream; name="nbd-trim-discard-support.diff" Content-Disposition: attachment; filename="nbd-trim-discard-support.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h6fix2s51 RGVzY3JpcHRpb246IFRoaXMgcGF0Y2ggYWRkcyBkaXNjYXJkIHN1cHBvcnQgdG8gbmJkLiBXaGVu IHRoZSBuYmQgY2xpZW50CnN5c3RlbSByZWNlaXZlcyBhIGRpc2NhcmQgcmVxdWVzdCwgdGhpcyB3 aWxsIGJlIHBhc3NlZCBhbG9uZyB0byB0aGUgbmJkCnNlcnZlciBzeXN0ZW0sIHdoZXJlIHRoZSBu YmQtc2VydmVyIHdpbGwgcmVzcG9uZCBieSBwZXJmb3JtaW5nOgoJZmFsbG9jYXRlKC4uIEZBTExP Q19GTF9QVU5DSF9IT0xFIC4uKQoKVG8gcHVuY2ggYSBob2xlIGluIHRoZSBiYWNrZW5kIHN0b3Jh Z2UsIHdoaWNoIGlzIG5vIGxvbmdlciBuZWVkZWQuCgpTaWduZWQtb2ZmLWJ5OiBQYXVsIENsZW1l bn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y2ggdXNlcnNwYWNlICovCisjZGVmaW5lIE5CRF9GTEFHX1NFTkRf VFJJTQkoMSA8PCA1KSAvKiBzZW5kIHRyaW0vZGlzY2FyZCAqLwogCiAjZGVmaW5lIG5iZF9jbWQo cmVxKSAoKHJlcSktPmNtZFswXSkKIAo= --20cf3010edad6d43e904c85a588c-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/